:root {
    color-scheme: light dark;
    --page-bg: #f5f5f7;
    --page-bg-2: #ffffff;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-solid: #ffffff;
    --surface-muted: rgba(245, 245, 247, 0.84);
    --surface-hover: rgba(255, 255, 255, 0.92);
    --surface-pressed: rgba(229, 232, 237, 0.9);
    --line: rgba(29, 29, 31, 0.12);
    --line-strong: rgba(29, 29, 31, 0.2);
    --text: #1d1d1f;
    --muted: #6e6e73;
    --muted-2: #8b8b91;
    --accent: #0071e3;
    --green: #1f9d62;
    --orange: #b7611d;
    --cyan: #087a91;
    --rose: #b54863;
    --yellow: #8f6a09;
    --red: #d93025;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 8px 26px rgba(0, 0, 0, 0.06);
    --blur: saturate(180%) blur(22px);
    --radius: 8px;
    --layout-width: 1220px;
    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
    --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-bg: #000000;
        --page-bg-2: #111113;
        --surface: rgba(29, 29, 31, 0.68);
        --surface-solid: #1d1d1f;
        --surface-muted: rgba(39, 39, 42, 0.78);
        --surface-hover: rgba(46, 46, 49, 0.86);
        --surface-pressed: rgba(58, 58, 61, 0.9);
        --line: rgba(255, 255, 255, 0.14);
        --line-strong: rgba(255, 255, 255, 0.24);
        --text: #f5f5f7;
        --muted: #a1a1a6;
        --muted-2: #7d7d83;
        --accent: #2997ff;
        --green: #32d074;
        --orange: #ff9f45;
        --cyan: #64d2ff;
        --rose: #ff6f91;
        --yellow: #ffd65a;
        --red: #ff453a;
        --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
        --shadow-soft: 0 8px 26px rgba(0, 0, 0, 0.26);
    }
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    background: var(--page-bg);
}

body.extra-shell {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        linear-gradient(180deg, var(--page-bg-2) 0, var(--page-bg) 18rem),
        var(--page-bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
    opacity: 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.extra-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 18rem),
        linear-gradient(90deg, transparent, rgba(0, 113, 227, 0.045), transparent);
}

@media (prefers-color-scheme: dark) {
    body.extra-shell::before {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 20rem),
            linear-gradient(90deg, transparent, rgba(41, 151, 255, 0.07), transparent);
    }
}

body.extra-shell::after,
.reveal-light {
    display: none;
}

body.dialog-open {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 74%, transparent);
    outline-offset: 3px;
}

.top-strip {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    width: 100%;
    padding: 0.54rem max(0.9rem, calc((100vw - var(--layout-width)) / 2));
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    scrollbar-width: none;
}

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

.status-chip,
.command-link,
.command-button,
.icon-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    color: var(--text);
    box-shadow: none;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.status-chip {
    padding: 0.38rem 0.62rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.command-link,
.command-button {
    gap: 0.38rem;
    padding: 0.46rem 0.72rem;
    font-size: 0.84rem;
    font-weight: 650;
    cursor: pointer;
}

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

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

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

.command-link:hover,
.command-link:focus-visible,
.command-button:hover,
.command-button:focus-visible,
.icon-command:hover,
.icon-command:focus-visible,
.traffic-interval-button:hover,
.traffic-interval-button:focus-visible,
.traffic-nav-button:hover,
.traffic-nav-button:focus-visible {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.command-link:active,
.command-button:active,
.icon-command:active {
    transform: translateY(0);
    background: var(--surface-pressed);
}

.page-main,
.dashboard-main {
    width: 100%;
    max-width: var(--layout-width);
    margin: 0 auto;
    padding: clamp(1rem, 2.8vw, 2rem) clamp(1rem, 2.4vw, 1.5rem) 3.5rem;
}

.hero-zone {
    display: grid;
    justify-items: center;
    gap: 0.9rem;
    width: 100%;
    min-width: 0;
    padding: clamp(2.2rem, 7vw, 5rem) 0 clamp(1.6rem, 4vw, 3rem);
    text-align: center;
}

.site-dashboard .hero-zone,
.site-sites .hero-zone {
    padding-block: clamp(1.6rem, 5vw, 3.6rem) clamp(1rem, 3vw, 2rem);
}

.hero-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
}

.mega-title {
    max-width: min(100%, 980px);
    margin: 0;
    color: var(--text);
    font-size: clamp(3.25rem, 11vw, 7.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: 0;
}

.site-dashboard .mega-title,
.site-sites .mega-title {
    font-size: clamp(2.7rem, 8vw, 5.8rem);
}

.mega-title .accent {
    display: inline;
    background: none;
    color: inherit;
    animation: none;
}

.connection-line {
    width: min(100%, 48rem);
    min-height: 1.45rem;
    margin: 0;
    color: var(--muted);
    font-size: clamp(0.9rem, 2vw, 1.08rem);
    font-weight: 450;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.connection-line strong {
    color: var(--text) !important;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 0.4rem;
}

.hero-actions .command-link {
    min-width: 9rem;
    min-height: 2.7rem;
    padding-inline: 1rem;
    background: var(--surface-solid);
    box-shadow: var(--shadow-soft);
}

.section-shell {
    width: 100%;
    margin-top: clamp(1.4rem, 4vw, 2.3rem);
}

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

.section-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.22rem, 2.7vw, 1.75rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: 0;
}

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

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

.data-panel,
.stat-card,
.cf-tunnel-card,
.status-monitor-card,
.site-card,
.sites-dialog-panel,
.empty-panel,
.status-detail-panel,
.ping-pill,
.service-card,
.internet-history-panel,
.internet-chart-shell,
.visitor-row,
.visitor-empty,
.update-files-panel,
.delete-confirmation {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}

.data-panel,
.stat-card,
.cf-tunnel-card,
.status-monitor-card,
.site-card,
.sites-form-panel,
.sites-dialog-panel,
.status-detail-panel {
    position: relative;
    overflow: hidden;
}

.data-panel {
    background: color-mix(in srgb, var(--surface-solid) 58%, transparent);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius);
    scrollbar-width: none;
}

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

.data-table thead {
    background: var(--surface-muted);
    color: var(--muted);
}

.data-table th,
.data-table td {
    padding: 0.92rem 1rem;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.data-table th {
    border-top: 0;
    font-size: 0.78rem;
    font-weight: 700;
}

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

.data-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

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

.mono-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.muted-value,
.text-uk-text-muted {
    color: var(--muted) !important;
}

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

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

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

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

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.min-h-screen {
    min-height: 100vh;
}

.flex-grow {
    flex-grow: 1;
}

.font-bold {
    font-weight: 700;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
}

.status-dot {
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 999px;
    background: currentColor;
}

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

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

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

.ping-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.ping-pill {
    min-height: 2.35rem;
    margin: 0;
    padding: 0.48rem 0.7rem;
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

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

.service-card {
    --accent-line: var(--green);
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    min-height: 4.6rem;
    padding: 0.92rem 1rem;
    color: var(--text);
    text-decoration: none;
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.service-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--accent-line);
    border-radius: var(--radius) 0 0 var(--radius);
}

.service-direct {
    --accent-line: var(--green);
}

.service-cloudflare {
    --accent-line: var(--orange);
}

.service-card:hover,
.service-card:focus-visible,
.stat-card:hover,
.stat-card:focus-within,
.cf-tunnel-card:hover,
.cf-tunnel-card:focus-within,
.status-monitor-button:hover,
.status-monitor-button:focus-visible,
.site-card:hover,
.site-card:focus-within {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    background: var(--surface-hover);
    box-shadow: var(--shadow);
}

.service-name {
    min-width: 0;
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 650;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.service-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.22rem 0.48rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-line) 13%, transparent);
    color: var(--accent-line);
    font-size: 0.7rem;
    font-weight: 700;
}

.service-direct .service-badge::before {
    content: "Direct";
}

.service-cloudflare .service-badge::before {
    content: "Proxy";
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: var(--layout-width);
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.dashboard-grid,
.cf-tunnel-grid,
.status-card-grid,
.sites-grid,
.internet-history-grid {
    display: grid;
    gap: 0.9rem;
}

.dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cf-tunnel-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.status-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: 1fr;
    align-items: stretch;
}

.stat-card,
.cf-tunnel-card,
.status-monitor-card,
.site-card {
    padding: 1rem;
}

.stat-card h3,
.cf-tunnel-card h4,
.status-card-title,
.site-card h3 {
    margin: 0 0 0.82rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: 0;
}

.metric-stack {
    display: grid;
    gap: 0.72rem;
}

.multi-line-stat-section {
    min-width: 0;
}

.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.82rem;
    font-weight: 600;
}

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

.small-progress-value {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
}

.progress-bar-container,
.upload-progress-track {
    width: 100%;
    height: 0.48rem;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.progress-bar,
.upload-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 420ms ease, background 180ms ease;
}

.progress-green {
    background: var(--green);
}

.progress-yellow {
    background: var(--yellow);
}

.progress-orange {
    background: var(--orange);
}

.progress-red {
    background: var(--red);
}

.dashboard-icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.system-card-grid,
.tunnel-grid {
    grid-auto-rows: 1fr;
    align-items: stretch;
}

.insight-card,
.tunnel-card {
    display: grid;
    height: 100%;
    color: var(--text);
}

.insight-card {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.72rem;
    min-height: 14.4rem;
}

.insight-card::before,
.tunnel-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 22%, transparent), transparent);
}

.insight-card-head,
.tunnel-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.insight-card-head h3 {
    min-width: 0;
    margin: 0;
}

.insight-pill,
.tunnel-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 1.65rem;
    max-width: 54%;
    padding: 0.26rem 0.58rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.insight-pill[data-tone="good"],
.tunnel-status[data-tone="good"] {
    color: var(--green);
}

.insight-pill[data-tone="degraded"],
.tunnel-status[data-tone="degraded"] {
    color: var(--yellow);
}

.insight-pill[data-tone="severely-degraded"],
.tunnel-status[data-tone="severely-degraded"] {
    color: var(--orange);
}

.insight-pill[data-tone="offline"],
.tunnel-status[data-tone="offline"] {
    color: var(--red);
}

.insight-meter-stack {
    align-content: stretch;
}

.metric-meter {
    --meter-color: var(--accent);
    display: grid;
    align-content: center;
    gap: 0.58rem;
    min-height: 3.7rem;
    padding: 0.66rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--meter-color) 10%, transparent), transparent 42%),
        color-mix(in srgb, var(--surface-muted) 68%, transparent);
}

.metric-meter[data-meter="cpu"] {
    --meter-color: var(--accent);
}

.metric-meter[data-meter="memory"] {
    --meter-color: var(--cyan);
}

.metric-meter[data-meter="temp"],
.metric-meter[data-meter="pressure"] {
    --meter-color: var(--orange);
}

.metric-meter[data-meter="load"] {
    --meter-color: var(--yellow);
}

.metric-meter[data-meter="download"] {
    --meter-color: var(--green);
}

.metric-meter[data-meter="upload"] {
    --meter-color: var(--accent);
}

.metric-meter[data-tone="good"] {
    --meter-color: var(--green);
}

.metric-meter[data-tone="degraded"] {
    --meter-color: var(--yellow);
}

.metric-meter[data-tone="severely-degraded"] {
    --meter-color: var(--orange);
}

.metric-meter[data-tone="offline"] {
    --meter-color: var(--red);
}

.metric-meter-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.58rem;
    min-width: 0;
}

.metric-glyph {
    position: relative;
    display: inline-grid;
    width: 2.05rem;
    height: 2.05rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--meter-color) 26%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--meter-color) 10%, transparent);
}

.metric-glyph svg,
.service-summary-icon svg,
.tunnel-metric-icon svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.metric-glyph--icon {
    color: var(--meter-color);
}

.metric-glyph--circle::before {
    content: "";
    width: 0.82rem;
    height: 0.82rem;
    border-radius: inherit;
    background: var(--meter-color);
    box-shadow: 0 0 0 0.32rem color-mix(in srgb, var(--meter-color) 14%, transparent);
}

.metric-meter-copy {
    display: grid;
    gap: 0.06rem;
    min-width: 0;
}

.metric-meter-copy small,
.service-summary-copy small,
.metric-count small,
.tunnel-connection small,
.tunnel-edge-card small,
.tunnel-metric-grid small {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.08;
    text-transform: uppercase;
}

.metric-meter-copy .small-progress-value {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.metric-count-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.56rem;
    align-content: end;
    min-height: 0;
}

.metric-count-grid--traffic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-count {
    display: grid;
    align-content: center;
    gap: 0.2rem;
    min-height: 4.1rem;
    min-width: 0;
    padding: 0.62rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
}

.metric-count--wide {
    grid-column: 1 / -1;
}

.metric-count .small-progress-value {
    color: var(--text);
    font-size: 1.02rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
    white-space: normal;
}

.flow-card {
    grid-template-rows: auto auto minmax(0, 1fr);
}

.service-summary-panel {
    --summary-color: var(--green);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.68rem;
    min-height: 6rem;
    padding: 0.72rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 12% 14%, color-mix(in srgb, var(--summary-color) 14%, transparent), transparent 38%),
        color-mix(in srgb, var(--surface-muted) 68%, transparent);
}

.service-summary-panel--docker {
    --summary-color: var(--cyan);
}

.service-summary-panel--wireguard {
    --summary-color: var(--green);
}

.service-summary-panel--cloudflare {
    --summary-color: var(--orange);
}

.service-summary-icon {
    display: inline-grid;
    width: 2.45rem;
    height: 2.45rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--summary-color) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--summary-color) 12%, transparent);
    color: var(--summary-color);
}

.service-summary-copy {
    display: grid;
    gap: 0.08rem;
    min-width: 0;
}

.service-summary-copy strong {
    color: var(--text);
    font-size: 1.26rem;
    font-weight: 800;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.service-summary-copy span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 650;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.service-summary-track,
.traffic-split-track {
    grid-column: 1 / -1;
    display: flex;
    width: 100%;
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.service-summary-track span,
.traffic-split-track span {
    display: block;
    min-width: 0;
    height: 100%;
    width: 0;
    transition: width 420ms ease, background 180ms ease;
}

.service-summary-track span {
    background: var(--green);
}

.traffic-split-download {
    background: var(--green);
}

.traffic-split-upload {
    background: var(--accent);
}

.traffic-split-track--cloudflare .traffic-split-download {
    background: var(--orange);
}

.traffic-split-track--cloudflare .traffic-split-upload {
    background: var(--cyan);
}

.tunnel-card {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.7rem;
    min-height: 14rem;
}

.tunnel-card[data-state="active"] {
    border-color: color-mix(in srgb, var(--green) 24%, var(--line));
}

.tunnel-card[data-state="offline"] {
    border-color: color-mix(in srgb, var(--red) 24%, var(--line));
}

.tunnel-connection {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.52rem;
    min-width: 0;
}

.tunnel-connection strong {
    display: block;
    color: var(--text);
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.05;
}

.tunnel-node {
    position: relative;
    display: inline-grid;
    width: 2.05rem;
    height: 2.05rem;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.tunnel-node::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border-radius: inherit;
    background: var(--yellow);
    box-shadow: 0 0 0 0.36rem color-mix(in srgb, var(--yellow) 16%, transparent);
}

.tunnel-card[data-state="active"] .tunnel-node::before {
    background: var(--green);
    box-shadow: 0 0 0 0.36rem color-mix(in srgb, var(--green) 16%, transparent);
}

.tunnel-card[data-state="offline"] .tunnel-node::before {
    background: var(--red);
    box-shadow: 0 0 0 0.36rem color-mix(in srgb, var(--red) 16%, transparent);
}

.tunnel-edge-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-width: 0;
    min-height: 4.05rem;
    padding: 0.72rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--orange) 11%, transparent), transparent 34%),
        radial-gradient(circle at 82% 82%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 36%),
        color-mix(in srgb, var(--surface-muted) 68%, transparent);
}

.tunnel-edge-card strong {
    min-width: 0;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    overflow-wrap: anywhere;
}

.tunnel-card-body {
    display: grid;
    gap: 0.58rem;
    min-width: 0;
    min-height: 0;
}

.tunnel-metric-stack {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.tunnel-metric-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.52rem;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0.46rem 0.56rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
}

.tunnel-metric-icon {
    display: inline-grid;
    width: 1.42rem;
    height: 1.42rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
}

.tunnel-metric-row[aria-label="Download"] .tunnel-metric-icon {
    border-color: color-mix(in srgb, var(--green) 22%, transparent);
    background: color-mix(in srgb, var(--green) 10%, transparent);
    color: var(--green);
}

.tunnel-metric-row[aria-label="Upload"] .tunnel-metric-icon {
    border-color: color-mix(in srgb, var(--cyan) 22%, transparent);
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    color: var(--cyan);
}

.tunnel-metric-row strong {
    min-width: 0;
    max-width: 100%;
    color: var(--text);
    font-size: clamp(0.82rem, 1.5vw, 1rem);
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.status-monitor-card {
    display: grid;
    align-content: start;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.72rem;
    min-height: 14.4rem;
    height: 100%;
    color: var(--text);
    text-align: left;
}

.status-monitor-button {
    appearance: none;
    width: 100%;
    cursor: pointer;
}

.power-internet-card {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.72rem;
}

.power-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.power-card-head .status-card-title {
    min-width: 0;
}

.power-card-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    max-width: 58%;
    padding: 0.26rem 0.58rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
}

.power-card-pill[data-tone="good"] {
    color: var(--green);
}

.power-card-pill[data-tone="degraded"] {
    color: var(--yellow);
}

.power-card-pill[data-tone="severely-degraded"] {
    color: var(--orange);
}

.power-card-pill[data-tone="offline"] {
    color: var(--red);
}

.power-card-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 0.7rem;
    align-self: center;
    min-height: 5.15rem;
    padding: 0.68rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 18% 20%, color-mix(in srgb, var(--green) 10%, transparent), transparent 34%),
        radial-gradient(circle at 82% 80%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 36%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--green) 7%, var(--surface-solid)) 0%,
            color-mix(in srgb, var(--surface-solid) 96%, var(--accent)) 52%,
            color-mix(in srgb, var(--accent) 7%, var(--surface-solid)) 100%);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 7%, transparent);
}

.power-node {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.52rem;
    min-width: 0;
}

.power-node-icon {
    position: relative;
    display: inline-grid;
    width: 2.05rem;
    height: 2.05rem;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.power-node-icon::before {
    content: "";
    width: 1.02rem;
    height: 1.02rem;
    border-radius: inherit;
    background: var(--yellow);
    box-shadow: 0 0 0 0.38rem color-mix(in srgb, var(--yellow) 16%, transparent);
}

.power-node[data-tone="good"] .power-node-icon::before {
    background: var(--green);
    box-shadow: 0 0 0 0.38rem color-mix(in srgb, var(--green) 16%, transparent);
}

.power-node[data-tone="offline"] .power-node-icon::before {
    background: var(--red);
    box-shadow: 0 0 0 0.38rem color-mix(in srgb, var(--red) 16%, transparent);
}

.power-node[data-tone="severely-degraded"] .power-node-icon::before {
    background: var(--orange);
    box-shadow: 0 0 0 0.38rem color-mix(in srgb, var(--orange) 16%, transparent);
}

.power-node-copy {
    display: grid;
    gap: 0.08rem;
    min-width: 0;
}

.power-node-copy small {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.power-node-copy strong {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.05;
}

.power-node[data-tone="good"] .power-node-copy strong {
    color: var(--green);
}

.power-node[data-tone="degraded"] .power-node-copy strong {
    color: var(--yellow);
}

.power-node[data-tone="severely-degraded"] .power-node-copy strong {
    color: var(--orange);
}

.power-node[data-tone="offline"] .power-node-copy strong {
    color: var(--red);
}

.power-last-outage {
    display: block;
    min-height: 1.2rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.status-monitor-card--status-only {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.status-monitor-card--status-only .status-card-title {
    margin: 0;
}

.status-monitor-card--status-only .status-card-value {
    align-self: start;
    justify-self: start;
    min-height: 0;
    padding: 0.26rem 0.58rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
}

.status-card-title {
    margin: 0;
}

.status-card-value {
    min-height: 1.9rem;
    color: var(--text);
    font-size: 1.45rem;
    font-weight: 750;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.status-card-value[data-tone="good"],
.traffic-status-pill[data-tone="good"],
.uptime-summary-grid strong[data-tone="good"],
.internet-history-overview strong[data-tone="good"] {
    color: var(--green);
}

.status-card-value[data-tone="degraded"],
.traffic-status-pill[data-tone="degraded"],
.uptime-summary-grid strong[data-tone="degraded"],
.internet-history-overview strong[data-tone="degraded"] {
    color: var(--yellow);
}

.status-card-value[data-tone="severely-degraded"],
.traffic-status-pill[data-tone="severely-degraded"],
.uptime-summary-grid strong[data-tone="severely-degraded"],
.internet-history-overview strong[data-tone="severely-degraded"] {
    color: var(--orange);
}

.status-card-value[data-tone="offline"],
.traffic-status-pill[data-tone="offline"],
.uptime-summary-grid strong[data-tone="offline"],
.internet-history-overview strong[data-tone="offline"] {
    color: var(--red);
}

.status-event-list,
.status-history-list {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.42;
}

.status-event-line,
.status-empty-line,
.status-loading {
    display: block;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.internet-live-grid,
.traffic-total-grid,
.uptime-summary-grid,
.internet-history-overview,
.internet-history-stats,
.site-metrics,
.site-resource-metrics {
    display: grid;
    gap: 0.55rem;
}

.internet-live-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-self: end;
    margin-top: auto;
}

.traffic-total-grid,
.uptime-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.internet-live-grid span,
.traffic-total-grid span,
.uptime-summary-grid span,
.internet-history-overview span,
.internet-history-stats span,
.site-metrics > span,
.site-metrics > button,
.site-resource-item {
    display: grid;
    align-content: center;
    gap: 0.18rem;
    min-width: 0;
    min-height: 3.25rem;
    padding: 0.64rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
}

.status-card-grid .internet-live-grid span,
.status-card-grid .traffic-total-grid span {
    min-height: 2.95rem;
    padding: 0.56rem;
}

.internet-live-grid small,
.traffic-total-grid small,
.uptime-summary-grid small,
.internet-history-overview small,
.internet-history-stats small,
.site-metrics small,
.site-resource-item small {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.15;
}

.internet-live-grid strong,
.traffic-total-grid strong,
.uptime-summary-grid strong,
.internet-history-overview strong,
.internet-history-stats strong,
.site-metrics strong,
.site-resource-item strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 750;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.traffic-card {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0.62rem;
}

.traffic-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    width: 100%;
}

.traffic-card-heading-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.traffic-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.46rem;
    padding: 0.2rem 0.46rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 750;
    text-transform: uppercase;
    white-space: nowrap;
}

.traffic-interval-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.2rem;
    width: 100%;
    padding: 0.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
}

.traffic-interval-button,
.traffic-nav-button {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
}

.traffic-interval-button {
    min-height: 1.76rem;
    padding: 0.24rem 0.36rem;
}

.traffic-interval-button.is-active {
    border-color: var(--line);
    background: var(--surface-solid);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.traffic-range-control {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 2rem;
    align-items: center;
    align-self: center;
    gap: 0.36rem;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.42rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 62%, transparent);
}

.traffic-range-control span {
    min-width: 0;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 650;
    text-align: center;
    overflow-wrap: anywhere;
}

.traffic-nav-button {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-color: var(--line);
    background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
}

.traffic-total-grid {
    margin-top: auto;
}

.traffic-nav-button:disabled,
.site-sites .command-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.status-detail-dialog,
.sites-dialog {
    width: min(94vw, 1120px);
    max-height: 88vh;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    color: var(--text);
}

.sites-dialog {
    width: min(92vw, 860px);
}

.status-detail-dialog::backdrop,
.sites-dialog::backdrop {
    background: rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

@media (prefers-color-scheme: dark) {
    .status-detail-dialog::backdrop,
    .sites-dialog::backdrop {
        background: rgba(0, 0, 0, 0.62);
    }
}

.status-detail-panel,
.sites-dialog-panel {
    max-height: 88vh;
    overflow: auto;
    padding: 1rem;
    border-color: var(--line-strong);
}

.status-detail-panel > .section-heading,
.sites-dialog-panel > .section-heading {
    align-items: flex-start;
    margin-bottom: 1rem;
}

.status-detail-body {
    min-height: 9rem;
}

.icon-command {
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    cursor: pointer;
}

.uptime-history-layout,
.uptime-timeline {
    display: grid;
    gap: 0.75rem;
}

.uptime-timeline-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.72rem;
    padding: 0.72rem 0;
    border-bottom: 1px solid var(--line);
}

.uptime-timeline-dot {
    width: 0.68rem;
    height: 0.68rem;
    border-radius: 999px;
    background: var(--green);
}

.uptime-timeline-item[data-type="downtime"] .uptime-timeline-dot {
    background: var(--red);
}

.uptime-timeline-item[data-type="internet_outage"] .uptime-timeline-dot {
    background: var(--orange);
}

.uptime-timeline-item[data-type="internet_restored"] .uptime-timeline-dot {
    background: var(--green);
}

.uptime-timeline-item div {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.uptime-timeline-item strong,
.uptime-timeline-item b {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.uptime-timeline-item span:not(.uptime-timeline-dot) {
    color: var(--muted);
    font-size: 0.78rem;
}

.uptime-timeline-item b {
    text-align: right;
    white-space: nowrap;
}

.internet-history-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.9rem;
}

.internet-history-grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.internet-history-panel {
    padding: 0.88rem;
}

.internet-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.7rem;
}

.internet-history-head strong {
    color: var(--text);
    font-weight: 700;
}

.internet-history-stats {
    grid-template-columns: repeat(3, minmax(4.2rem, 1fr));
    flex: 0 0 min(58%, 18rem);
}

.internet-history-stats span[data-tone="online"] strong,
.internet-point[data-tone="online"] .internet-marker {
    color: var(--green);
    fill: var(--green);
}

.internet-history-stats span[data-tone="lossy"] strong,
.internet-point[data-tone="lossy"] .internet-marker {
    color: var(--yellow);
    fill: var(--yellow);
}

.internet-history-stats span[data-tone="offline"] strong,
.internet-point[data-tone="offline"] .internet-marker {
    color: var(--red);
    fill: var(--red);
}

.internet-chart-shell {
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-muted) 64%, transparent);
}

.internet-history-chart {
    display: block;
    width: 100%;
    height: 184px;
    overflow: visible;
}

.internet-history-chart polyline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.6;
    vector-effect: non-scaling-stroke;
}

.internet-plot-area {
    fill: transparent;
    stroke: var(--line);
}

.internet-axis-tick line,
.internet-axis-line {
    stroke: var(--line-strong);
    vector-effect: non-scaling-stroke;
}

.internet-axis-tick text,
.internet-empty-chart {
    fill: var(--muted);
    font-size: 16px;
    font-weight: 600;
}

.internet-marker {
    stroke: var(--surface-solid);
    stroke-width: 1.3;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.internet-hover-point {
    cursor: crosshair;
    fill: transparent;
    stroke: transparent;
    pointer-events: all;
}

.internet-point:hover .internet-marker,
.internet-point:focus-within .internet-marker {
    stroke: var(--text);
}

.internet-chart-tooltip {
    position: fixed;
    z-index: 9999;
    display: grid;
    gap: 0.18rem;
    min-width: 12rem;
    padding: 0.68rem 0.78rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-solid);
    color: var(--muted);
    box-shadow: var(--shadow);
    font-size: 0.78rem;
    line-height: 1.35;
    pointer-events: none;
}

.internet-chart-tooltip[hidden] {
    display: none;
}

.internet-chart-tooltip strong {
    color: var(--text);
    font-size: 0.86rem;
}

.internet-chart-tooltip b {
    color: var(--accent);
}

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

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

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

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

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

.auth-panel-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.18rem;
    line-height: 1.14;
    font-weight: 750;
}

.auth-panel-head p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.auth-badge {
    flex: 0 0 auto;
    min-height: 1.8rem;
    padding: 0.34rem 0.6rem;
    border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 11%, transparent);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 750;
}

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

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

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

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

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

.field-shell,
.toggle-shell,
.route-toggle {
    display: flex;
    gap: 0.42rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 650;
}

.field-shell {
    flex-direction: column;
    min-width: 0;
}

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

.field-shell input,
.field-shell select {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.58rem 0.72rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.field-shell input::placeholder {
    color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.field-shell input:focus,
.field-shell select:focus {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
    background: var(--surface-solid);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.field-shell select option {
    background: var(--surface-solid);
    color: var(--text);
}

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

.field-shell input[type="file"]::file-selector-button {
    min-height: 1.9rem;
    margin-right: 0.65rem;
    padding: 0.32rem 0.62rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}

.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: var(--radius) 0 0 var(--radius);
}

.field-shell .domain-suffix {
    display: inline-flex;
    align-items: center;
    min-height: 2.55rem;
    padding: 0.58rem 0.72rem;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
    white-space: nowrap;
}

.route-toggle {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    flex-direction: column;
}

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

.route-toggle legend {
    padding: 0;
}

.route-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem;
    min-width: 0;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-muted) 74%, transparent);
}

.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.6rem;
    align-items: center;
    min-height: 2.38rem;
    padding: 0.48rem 0.58rem;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--muted);
    line-height: 1.05;
}

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

.route-toggle strong {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
}

.route-toggle small {
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 650;
}

.route-toggle label span::after {
    content: "";
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 999px;
    background: var(--muted-2);
}

.route-toggle label:hover span,
.route-toggle input:focus-visible + span {
    border-color: var(--line);
    background: var(--surface-hover);
}

.route-toggle input:checked + span {
    border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
    background: var(--surface-solid);
    box-shadow: var(--shadow-soft);
}

.route-toggle input[value="cloudflare"]:checked + span::after {
    background: var(--orange);
}

.route-toggle input[value="direct"]:checked + span::after {
    background: var(--green);
}

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

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

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

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

.inline-message {
    min-height: 1.25rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

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

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

.danger-button {
    border-color: color-mix(in srgb, var(--red) 42%, var(--line)) !important;
    color: var(--red) !important;
}

.update-files-panel,
.delete-confirmation {
    margin-top: 0.9rem;
    padding: 0.82rem;
    background: color-mix(in srgb, var(--surface-muted) 74%, transparent);
}

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

.update-files-head strong,
.delete-confirmation strong {
    color: var(--text);
    font-size: 0.92rem;
}

.update-files-head span,
.delete-confirmation p {
    color: var(--muted);
    font-size: 0.78rem;
}

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

.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.8rem;
    font-weight: 650;
}

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

.upload-progress-bar {
    background: var(--accent);
}

.sites-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.site-card {
    display: grid;
    gap: 0.78rem;
}

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

.site-card h3 {
    margin-bottom: 0.2rem;
    overflow-wrap: anywhere;
}

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

.site-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.site-facts span {
    min-height: 1.72rem;
    padding: 0.32rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 650;
}

.site-facts .route-chip {
    color: var(--orange);
}

.site-facts .route-direct {
    color: var(--green);
}

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

.site-metrics button {
    appearance: none;
    cursor: pointer;
    color: var(--muted);
    text-align: left;
    font: inherit;
}

.site-metrics button:hover,
.site-metrics button:focus-visible {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.site-resource-item {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.44rem;
}

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

.site-resource-item small {
    grid-column: 2;
}

.resource-icon {
    grid-row: 1 / span 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 6px;
    background: color-mix(in srgb, var(--green) 12%, transparent);
    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 {
    background: color-mix(in srgb, var(--cyan) 12%, transparent);
    color: var(--cyan);
}

.resource-icon-disk {
    background: color-mix(in srgb, var(--orange) 12%, transparent);
    color: var(--orange);
}

.site-actions {
    gap: 0.45rem;
}

.site-action {
    --action-accent: var(--accent);
    border-color: color-mix(in srgb, var(--action-accent) 28%, var(--line));
    background: color-mix(in srgb, var(--action-accent) 9%, transparent);
    color: var(--text);
}

.site-action::before {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: var(--action-accent);
}

.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(--accent);
}

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

.site-error {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
}

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

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

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

.visitor-row,
.visitor-empty {
    padding: 0.72rem;
}

.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.8rem;
    font-weight: 600;
}

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

.delete-confirmation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    border-color: color-mix(in srgb, var(--red) 28%, var(--line));
}

.delete-confirmation p {
    margin: 0.15rem 0 0;
}

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

@media (min-width: 1120px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

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

@media (max-width: 980px) {
    .site-sites #upload-form .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .top-strip {
        justify-content: flex-start;
        min-height: 3rem;
        padding: 0.5rem 0.72rem;
    }

    .top-strip .status-chip,
    .top-strip .command-link,
    .top-strip .command-button {
        flex: 0 0 auto;
    }

    .page-main,
    .dashboard-main {
        padding-inline: 0.82rem;
    }

    .hero-zone {
        justify-items: start;
        text-align: left;
    }

    .hero-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .hero-actions .command-link {
        flex: 1 1 12rem;
    }

    .connection-line {
        font-size: 0.92rem;
    }

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

    .service-grid,
    .dashboard-grid,
    .cf-tunnel-grid,
    .status-card-grid,
    .form-grid,
    .site-sites #upload-form .form-grid,
    .sites-grid,
    .internet-live-grid,
    .traffic-total-grid,
    .uptime-summary-grid,
    .internet-history-overview,
    .internet-history-stats,
    .site-metrics,
    .site-resource-metrics {
        grid-template-columns: 1fr;
    }

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

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

    .status-monitor-card {
        min-height: 14.4rem;
    }

    .status-card-grid .internet-live-grid,
    .status-card-grid .traffic-total-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .traffic-card-heading,
    .internet-history-head,
    .auth-panel-head,
    .site-card-head,
    .delete-confirmation,
    .visitor-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .traffic-card-heading-actions,
    .delete-confirmation-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .traffic-status-pill {
        white-space: normal;
    }

    .traffic-update-pill {
        white-space: nowrap;
    }

    .internet-history-grid {
        grid-template-columns: 1fr;
    }

    .internet-history-stats {
        width: 100%;
        flex: none;
    }

    .uptime-timeline-item {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: flex-start;
    }

    .uptime-timeline-item b {
        grid-column: 2;
        text-align: left;
    }

    .status-detail-panel,
    .sites-dialog-panel {
        padding: 0.82rem;
    }

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

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

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

    .site-dashboard .mega-title,
    .site-sites .mega-title {
        font-size: 2.3rem;
    }

    .status-chip,
    .command-link,
    .command-button {
        font-size: 0.78rem;
    }

    .service-card,
    .stat-card,
    .cf-tunnel-card,
    .status-monitor-card,
    .site-card {
        padding: 0.82rem;
    }

    .route-options {
        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;
    }
}
