* {
    box-sizing: border-box;
}

:root {
    --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
    --surface-strong: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(248, 251, 255, 0.76) 100%);
    --surface-soft: rgba(255, 255, 255, 0.58);
    --surface-border: rgba(188, 203, 232, 0.34);
    --shadow-soft: 0 8px 24px rgba(119, 141, 180, 0.1);
    --shadow-hover: 0 14px 34px rgba(119, 141, 180, 0.14);
    --focus-ring: 0 0 0 4px rgba(103, 146, 255, 0.16);
}

body {
    margin: 0;
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 18%, rgba(126, 182, 255, 0.1), transparent 28%),
        radial-gradient(circle at 84% 14%, rgba(183, 167, 255, 0.08), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
    color: #14213d;
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.modal-open {
    overflow: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    filter: blur(24px);
    opacity: 0.28;
    animation: floatBlob 18s ease-in-out infinite;
}

body::before {
    top: 6vh;
    left: -4vw;
    width: 28vw;
    height: 28vw;
    border-radius: 50%;
    background: rgba(122, 170, 255, 0.16);
}

body::after {
    right: -6vw;
    bottom: 8vh;
    width: 30vw;
    height: 30vw;
    border-radius: 50%;
    background: rgba(204, 193, 255, 0.18);
    animation-delay: -6s;
}

a {
    color: inherit;
}

h1,
h2,
p {
    margin-top: 0;
}

code,
pre {
    font: 13px/1.5 "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 14px 26px;
}

.dashboard-shell {
    display: grid;
    gap: 10px;
}

.topbar,
.actions,
.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.topbar {
    margin-bottom: 8px;
    padding: 4px 2px 0;
}

.topbar-copy {
    display: grid;
    gap: 4px;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.48);
    color: #60718f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 32px;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: #13213f;
}

.topbar-subtitle {
    margin: 0;
    max-width: 520px;
    color: #71809d;
    font-size: 13px;
}

.actions,
.button-row.wrap {
    flex-wrap: wrap;
}

.grid.two,
.stats-grid,
.codes-grid,
.route-form-grid,
.quick-route-form {
    display: grid;
    gap: 10px;
}

.grid.two {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 8px;
}

.card,
.stat-card {
    background: var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 13px;
    margin-bottom: 10px;
    box-shadow:
        var(--shadow-soft),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    transition:
        transform 180ms var(--ease-out-strong),
        box-shadow 180ms var(--ease-out-strong),
        background-color 180ms var(--ease-out-strong),
        border-color 180ms var(--ease-out-strong);
    animation: fadeUp 0.28s ease;
}

.card:hover,
.stat-card:hover {
    transform: translateY(-1px);
    box-shadow:
        var(--shadow-hover),
        inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.compact-card {
    padding: 14px 18px;
}

.section-card {
    padding: 14px;
}

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

.section-head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.section-text {
    margin: 4px 0 0;
    color: #7a88a3;
    font-size: 12px;
}

.stat-card {
    min-height: 74px;
    display: grid;
    gap: 4px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -24px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    opacity: 0.45;
}

.stat-card-routes::after {
    background: radial-gradient(circle, rgba(120, 163, 255, 0.26) 0%, rgba(120, 163, 255, 0) 72%);
}

.stat-card-dns::after {
    background: radial-gradient(circle, rgba(155, 203, 255, 0.24) 0%, rgba(155, 203, 255, 0) 72%);
}

.stat-card-traffic::after {
    background: radial-gradient(circle, rgba(123, 226, 181, 0.24) 0%, rgba(123, 226, 181, 0) 72%);
}

.stat-card-security::after {
    background: radial-gradient(circle, rgba(191, 173, 255, 0.24) 0%, rgba(191, 173, 255, 0) 72%);
}

.stat-card strong {
    font-size: 18px;
    line-height: 1;
    color: #0d1b3f;
}

.login-card {
    max-width: 320px;
    margin: 92px auto 0;
    padding: 12px;
    border-radius: 16px;
}

.login-card.has-error {
    background: rgba(255, 235, 239, 0.88);
    border-color: rgba(255, 152, 174, 0.72);
    box-shadow:
        0 20px 48px rgba(232, 129, 150, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.route-form-card {
    max-width: 500px;
}

.form-grid {
    display: grid;
    gap: 8px;
}

.quick-route-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
}

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

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.split-actions {
    gap: 8px;
    flex-wrap: wrap;
}

.section-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}

.section-chip-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(191, 204, 230, 0.4);
    color: #415578;
    font-size: 11px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.modal-launch-card {
    display: grid;
    gap: 12px;
    align-items: start;
}

.quick-route-form label {
    gap: 4px;
    font-size: 12px;
}

.quick-route-form input {
    padding: 8px 10px;
}

.quick-hint {
    display: flex;
    align-items: center;
    font-size: 11px;
}

.quick-route-form .form-actions button {
    min-width: 96px;
}

.modal-layer {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms var(--ease-out-strong);
    z-index: 120;
}

.modal-layer.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 26, 46, 0.22);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
}

.modal-shell {
    position: relative;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    z-index: 1;
}

.modal-shell-small {
    width: min(560px, calc(100vw - 32px));
}

.modal-card {
    position: relative;
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(247, 250, 255, 0.84) 100%);
    border: 1px solid rgba(255, 255, 255, 0.86);
    box-shadow:
        0 24px 60px rgba(17, 29, 53, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(26px) saturate(1.18);
    -webkit-backdrop-filter: blur(26px) saturate(1.18);
    transform: translateY(10px) scale(0.985);
    transition: transform 180ms var(--ease-out-strong);
}

.modal-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
    opacity: 0;
    transition: opacity 140ms var(--ease-out-strong);
}

.modal-progress::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 42%;
    background: linear-gradient(90deg, rgba(122, 167, 255, 0) 0%, rgba(122, 167, 255, 0.95) 50%, rgba(122, 167, 255, 0) 100%);
    transform: translateX(-120%);
}

.modal-card.is-submitting .modal-progress {
    opacity: 1;
}

.modal-card.is-submitting .modal-progress::before {
    animation: modalProgress 1.15s linear infinite;
}

.modal-card.is-submitting .modal-actions button,
.modal-card.is-submitting .modal-close {
    pointer-events: none;
}

.modal-layer.is-open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-head h2 {
    margin: 2px 0 0;
    font-size: 26px;
    line-height: 0.98;
    letter-spacing: -0.04em;
    color: #13213f;
}

.modal-eyebrow {
    background: rgba(255, 255, 255, 0.72);
}

.modal-eyebrow-danger {
    background: rgba(244, 108, 132, 0.12);
    color: #be4d69;
}

.modal-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #243963;
    font-size: 18px;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.82),
        0 8px 20px rgba(119, 141, 180, 0.12);
}

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

.modal-form-grid > .modal-preview-grid,
.modal-form-grid > .modal-hint,
.modal-form-grid > .modal-actions,
.modal-form-grid > .modal-checkbox {
    grid-column: 1 / -1;
}

.modal-form-grid-single {
    grid-template-columns: 1fr;
}

.modal-preview-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-preview-card {
    display: grid;
    gap: 5px;
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(244, 248, 255, 0.9);
    border: 1px solid rgba(189, 204, 232, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.modal-preview-card-wide {
    grid-column: 1 / -1;
}

.modal-preview-card-danger {
    background: rgba(255, 243, 246, 0.92);
    border-color: rgba(239, 167, 185, 0.42);
}

.modal-preview-label {
    color: #7e8dac;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.modal-preview-card strong {
    font-size: 13px;
    line-height: 1.3;
    color: #1a2948;
    word-break: break-word;
}

.modal-hint {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(244, 248, 255, 0.78);
    border: 1px solid rgba(189, 204, 232, 0.32);
    font-size: 12px;
}

.modal-checkbox {
    padding-top: 2px;
}

.modal-checkbox span {
    color: #30405f;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 2px;
}

.modal-error {
    margin-bottom: 0;
}

.floating-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 11px 13px;
    border-radius: 14px;
    background: rgba(20, 33, 61, 0.95);
    color: #f7f9ff;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: 0 18px 40px rgba(17, 29, 53, 0.24);
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 160ms var(--ease-out-strong), transform 160ms var(--ease-out-strong);
    z-index: 160;
}

.floating-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.routes-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--surface-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(18px) saturate(1.12);
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

.routes-toolbar input,
.routes-toolbar select {
    max-width: 320px;
    flex: 1 1 220px;
}

.table-wrap {
    overflow: visible;
    position: relative;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(189, 204, 232, 0.34);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.58),
        0 1px 0 rgba(188, 203, 232, 0.14);
}

.route-group + .route-group {
    margin-top: 10px;
}

.group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.group-head h3 {
    margin: 0 0 2px;
    font-size: 16px;
    line-height: 1.1;
}

.group-metrics {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    color: #60708d;
    white-space: nowrap;
    font-size: 10px;
}

.group-copy {
    display: grid;
    gap: 1px;
    text-align: left;
}

.group-metrics span {
    font-size: 12px;
    font-weight: 700;
    color: #20335d;
}

.group-metrics small {
    font-size: 10px;
}

.group-tree-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    color: inherit;
    cursor: pointer;
    transition:
        opacity 140ms var(--ease-out-strong),
        transform 140ms var(--ease-out-strong),
        color 140ms var(--ease-out-strong);
}

.group-tree-toggle:hover {
    transform: translateY(-1px);
    box-shadow: none;
    opacity: 1;
}

.group-tree-toggle:active {
    transform: scale(0.985);
}

.tree-glyph {
    position: relative;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.tree-glyph::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #7082a3;
    border-bottom: 2px solid #7082a3;
    transform: rotate(45deg);
    transition: transform 140ms var(--ease-out-strong), top 140ms var(--ease-out-strong), border-color 140ms var(--ease-out-strong);
}

.route-group.is-collapsed .group-head {
    margin-bottom: 0;
}

.route-group.is-collapsed .tree-glyph::before {
    top: 2px;
    transform: rotate(-45deg);
}

.instance-line {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    color: #52627f;
    font-size: 11px;
}

.route-meta {
    display: flex;
    align-items: center;
    gap: 6px 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.stage-line {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c7b98;
    font-size: 10px;
}

.stage-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(70, 110, 188, 0.1);
    color: #35548b;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.instance-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(107, 145, 227, 0.12);
    color: #44629f;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.route-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 0;
    margin-bottom: 1px;
}

.route-help-inline {
    flex: 0 0 auto;
}

.instance-text {
    line-height: 1.2;
}

.route-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(80, 108, 166, 0.12);
    color: #466293;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    outline: none;
    transition:
        transform 125ms var(--ease-out-strong),
        background-color 125ms var(--ease-out-strong),
        color 125ms var(--ease-out-strong),
        box-shadow 125ms var(--ease-out-strong);
}

.route-help::after {
    display: none;
}

.route-help:hover {
    transform: translateY(-1px);
    background: rgba(80, 108, 166, 0.18);
    box-shadow: 0 4px 10px rgba(70, 98, 147, 0.14);
}

.floating-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, calc(100vw - 24px));
    padding: 10px 11px;
    border-radius: 12px;
    background: rgba(20, 33, 61, 0.96);
    color: #f6f9ff;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 16px 34px rgba(17, 29, 53, 0.28);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px) scale(0.98);
    transition: opacity 125ms var(--ease-out-strong), transform 125ms var(--ease-out-strong);
    z-index: 140;
}

.floating-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.legacy-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(167, 132, 87, 0.12);
    color: #8e6b36;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

label {
    display: grid;
    gap: 4px;
    color: #30405f;
}

input,
select,
button,
.button,
pre {
    border-radius: 9px;
}

input,
select {
    width: 100%;
    border: 1px solid rgba(133, 155, 198, 0.35);
    background: rgba(255, 255, 255, 0.72);
    color: #152340;
    padding: 8px 10px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition:
        border-color 160ms var(--ease-out-strong),
        box-shadow 160ms var(--ease-out-strong),
        transform 160ms var(--ease-out-strong),
        background-color 160ms var(--ease-out-strong);
}

input:focus,
select:focus {
    border-color: rgba(91, 132, 255, 0.7);
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 4px rgba(103, 146, 255, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    transform: translateY(-1px);
}

.error-input {
    background: rgba(255, 244, 246, 0.96);
    border-color: rgba(255, 133, 162, 0.7);
    box-shadow: 0 0 0 4px rgba(255, 133, 162, 0.1);
}

button,
.button {
    border: none;
    padding: 6px 9px;
    background: linear-gradient(180deg, #7aa7ff 0%, #5e8eff 100%);
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    box-shadow:
        0 6px 14px rgba(94, 142, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition:
        transform 140ms var(--ease-out-strong),
        opacity 140ms var(--ease-out-strong),
        box-shadow 140ms var(--ease-out-strong),
        background-color 140ms var(--ease-out-strong),
        filter 140ms var(--ease-out-strong);
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow:
        0 10px 22px rgba(94, 142, 255, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

button:active,
.button:active {
    transform: scale(0.97);
    filter: saturate(0.98);
}

button.secondary,
.button.secondary {
    background: rgba(255, 255, 255, 0.75);
    color: #1d325f;
    box-shadow:
        0 10px 24px rgba(123, 145, 179, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

button.danger,
.button.danger {
    background: linear-gradient(180deg, #ff889f 0%, #f26682 100%);
}

.muted {
    color: #6c7b98;
}

.ok {
    color: #1d9b63;
}

.warn {
    color: #d68d22;
}

.error,
.notice,
.ok-banner {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.error {
    color: #8f3652;
    background: rgba(255, 239, 243, 0.88);
    border: 1px solid rgba(255, 188, 203, 0.56);
}

.notice {
    color: #30528d;
    background: rgba(239, 245, 255, 0.9);
    border: 1px solid rgba(185, 206, 255, 0.72);
}

.ok-banner {
    color: #24724e;
    background: rgba(237, 251, 243, 0.92);
    border: 1px solid rgba(171, 228, 195, 0.72);
}

.error-text {
    display: inline-block;
    margin-top: 4px;
    color: #bc5970;
    font-size: 11px;
}

.routes-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    table-layout: fixed;
}

.routes-table .col-domain {
    width: 37%;
}

.routes-table .col-port {
    width: 26%;
}

.routes-table .col-metrics {
    width: 20%;
}

.routes-table .col-actions {
    width: 17%;
}

th,
td {
    padding: 9px 8px;
    border-bottom: 1px solid rgba(180, 196, 226, 0.48);
    vertical-align: top;
    text-align: left;
}

th {
    color: #7381a2;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(245, 249, 255, 0.88);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
}

.metric-card {
    min-width: 0;
    padding: 1px 0;
}

.metric-numbers {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.metric-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    width: 100%;
}

.metric-numbers strong {
    font-size: 13px;
    line-height: 1;
}

.metric-numbers span {
    color: #7484a4;
    font-size: 10px;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-start;
}

.actions-row form {
    margin: 0;
}

.route-row {
    transition: background-color 140ms var(--ease-out-strong);
}

.route-row td {
    transition:
        background-color 140ms var(--ease-out-strong),
        border-color 140ms var(--ease-out-strong);
}

.route-row:hover td {
    background: rgba(255, 255, 255, 0.44);
}

.route-row:hover td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.route-row:hover td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.route-title,
.port-title {
    font-size: 13px;
    line-height: 1.08;
    color: #12203d;
}

.route-title {
    word-break: break-word;
}

.port-stack {
    display: grid;
    gap: 1px;
    align-content: start;
}

.port-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.port-caption {
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.port-target,
.port-instance {
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    line-height: 1.2;
}

.sparkline {
    width: 88px;
    min-width: 88px;
    height: 18px;
    overflow: visible;
}

.sparkline path {
    fill: none;
    stroke: #73a0ff;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 140ms var(--ease-out-strong), opacity 140ms var(--ease-out-strong);
}

.sparkline.errors path {
    stroke: #ff9bb0;
}

.logs {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.logs li {
    color: #31425f;
    padding: 8px 0;
    border-bottom: 1px solid rgba(188, 203, 232, 0.32);
}

.logs li + li {
    margin-top: 0;
}

.logs li:last-child {
    border-bottom: none;
}

pre {
    overflow: auto;
    background: rgba(255, 255, 255, 0.72);
    padding: 12px;
    border: 1px solid rgba(190, 205, 233, 0.58);
    white-space: pre-wrap;
    word-break: break-word;
}

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

.codes-grid code {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(190, 205, 233, 0.58);
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
    letter-spacing: 0.08em;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalProgress {
    from {
        transform: translateX(-120%);
    }
    to {
        transform: translateX(260%);
    }
}

@keyframes floatBlob {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(0, -10px, 0) scale(1.04);
    }
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
.route-help:focus-visible,
.group-tree-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

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

    body::before,
    body::after {
        animation: none;
    }

    .card:hover,
    .stat-card:hover,
    button:hover,
    .button:hover,
    .group-tree-toggle:hover,
    .route-help:hover {
        transform: none;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .card,
    .stat-card,
    .routes-toolbar,
    .table-wrap,
    th {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.96);
    }
}

@media (max-width: 1100px) {
    .stats-grid,
    .grid.two,
    .route-form-grid,
    .quick-route-form {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 860px) {
    .stats-grid,
    .grid.two,
    .route-form-grid,
    .quick-route-form,
    .codes-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .actions,
    .button-row {
        align-items: stretch;
        flex-direction: column;
    }

    .actions form,
    .actions a,
    .button-row form,
    .button-row a {
        width: 100%;
    }

    .topbar h1 {
        font-size: 28px;
    }

    .page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .section-text,
    .topbar-subtitle {
        max-width: none;
    }

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

    .modal-shell {
        width: min(100vw - 20px, 720px);
        max-height: calc(100vh - 20px);
    }

    .modal-card {
        padding: 16px;
        border-radius: 18px;
    }

    .modal-head {
        gap: 12px;
    }

    .modal-head h2 {
        font-size: 22px;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-preview-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table-wrap {
        overflow: visible;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .table-scroll {
        overflow: visible;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    table,
    thead,
    tbody {
        display: block;
        min-width: 0;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 8px;
    }

    .route-row {
        display: grid;
        gap: 0;
        border-radius: 14px;
        overflow: hidden;
        border: 1px solid rgba(188, 203, 232, 0.34);
        background: rgba(255, 255, 255, 0.62);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.64),
            0 8px 24px rgba(119, 141, 180, 0.1);
    }

    .route-row td {
        display: grid;
        gap: 5px;
        padding: 10px 12px;
        border-bottom: 1px solid rgba(188, 203, 232, 0.24);
        background: transparent;
    }

    .route-row td:last-child {
        border-bottom: none;
    }

    .route-row td::before {
        content: attr(data-label);
        color: #8090ae;
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .route-row:hover td,
    .route-row:hover td:first-child,
    .route-row:hover td:last-child {
        background: transparent;
        border-radius: 0;
    }

    .metric-card,
    .metric-inline {
        width: 100%;
    }

    .metric-inline {
        justify-content: space-between;
    }

    .sparkline {
        width: 104px;
        min-width: 104px;
    }

    .actions-row {
        gap: 6px;
    }

    .actions-row .button,
    .actions-row button {
        min-width: 58px;
    }

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

    .routes-toolbar input,
    .routes-toolbar select {
        max-width: none;
    }
}

@media (max-width: 560px) {
    .page {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card,
    .stat-card,
    .section-card {
        border-radius: 14px;
        padding: 12px;
    }

    .eyebrow {
        display: none;
    }

    .topbar h1 {
        font-size: 26px;
    }

    .topbar-subtitle,
    .section-text,
    .quick-hint {
        font-size: 11px;
    }

    .route-primary {
        gap: 5px;
    }

    .modal-layer {
        padding: 10px;
    }

    .floating-toast {
        right: 10px;
        bottom: 10px;
        left: 10px;
        max-width: none;
    }

    .modal-card {
        padding: 14px;
        border-radius: 16px;
    }

    .modal-head {
        align-items: flex-start;
    }

    .modal-head h2 {
        font-size: 20px;
    }

    .modal-preview-grid {
        grid-template-columns: 1fr;
    }

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

    .modal-actions .button,
    .modal-actions button {
        width: 100%;
    }

    .route-title,
    .port-title {
        font-size: 12px;
    }

    .metric-inline {
        gap: 6px;
    }

    .sparkline {
        width: 92px;
        min-width: 92px;
    }
}
