:root {
    --bg: #06101d;
    --bg-soft: #0d1828;
    --panel: rgba(14, 28, 47, 0.88);
    --panel-strong: #11233a;
    --line: rgba(112, 153, 203, 0.22);
    --text: #ecf4ff;
    --muted: #8ea8c9;
    --accent: #3dd5f3;
    --accent-strong: #12b9db;
    --accent-warm: #ff875a;
    --success: #34d28f;
    --warning: #f3b54b;
    --danger: #ff6675;
    --shadow: 0 30px 70px rgba(0, 0, 0, 0.32);
    --radius: 24px;
    --radius-sm: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Space Grotesk", "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(61, 213, 243, 0.14), transparent 24rem),
        radial-gradient(circle at bottom right, rgba(255, 135, 90, 0.12), transparent 22rem),
        linear-gradient(180deg, #071120 0%, #030913 100%);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 320px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid var(--line);
    background: rgba(4, 12, 23, 0.85);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 20;
}

.shell-main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 16, 29, 0.8);
    backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-right,
.split-line,
.actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-right {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-header,
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-header h2,
.panel h3,
.topbar-title,
.auth-card h2,
.center-card h1,
.redirect-card h1 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--accent);
}

.muted,
.topbar-user span,
.metric-card small,
.brand-card p,
.field span,
.table td,
.table th,
.empty-state {
    color: var(--muted);
}

.topbar-user {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.status-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid rgba(61, 213, 243, 0.2);
    border-radius: 999px;
    background: rgba(61, 213, 243, 0.08);
    color: var(--text);
    font-size: 0.86rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(52, 210, 143, 0.14);
}

.brand-card,
.panel,
.metric-card,
.route-card,
.auth-card,
.center-card,
.redirect-card,
.mini-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.brand-card {
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark,
.avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: #04111f;
}

.brand-card h2,
.route-card h4 {
    margin: 0 0 6px;
}

.nav-list,
.sidebar-footer,
.stack-md,
.stack-lg,
.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nav-link {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    background: transparent;
    transition: 180ms ease;
    display: block;
}

.nav-link span,
.user-card strong {
    display: block;
    font-weight: 700;
    color: var(--text);
}

.nav-link small,
.user-card span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.nav-link:hover,
.nav-link.is-active {
    background: linear-gradient(180deg, rgba(61, 213, 243, 0.12), rgba(255, 135, 90, 0.08));
    border-color: rgba(61, 213, 243, 0.2);
}

.user-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
}

.metric-grid,
.content-grid,
.routes-grid,
.info-grid,
.form-grid,
.bars {
    display: grid;
    gap: 18px;
}

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

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

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

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

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

.metric-card,
.panel,
.route-card,
.auth-card,
.center-card,
.redirect-card {
    padding: 22px;
}

.metric-card span,
.info-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.metric-card strong {
    display: block;
    margin: 12px 0 8px;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    line-height: 1;
}

.panel-head {
    margin-bottom: 18px;
}

.hero-panel {
    background:
        linear-gradient(135deg, rgba(61, 213, 243, 0.12), rgba(255, 135, 90, 0.08)),
        var(--panel);
}

.mini-panel {
    padding: 16px;
    border-radius: 18px;
}

.mini-panel strong {
    display: block;
    margin-bottom: 6px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-size: 0.86rem;
}

.input,
textarea.input {
    width: 100%;
    padding: 14px 15px;
    border-radius: 16px;
    border: 1px solid rgba(142, 168, 201, 0.18);
    background: rgba(3, 10, 18, 0.45);
    color: var(--text);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input:focus,
textarea.input:focus {
    border-color: rgba(61, 213, 243, 0.48);
    box-shadow: 0 0 0 4px rgba(61, 213, 243, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease;
    font-weight: 700;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: #04111f;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(142, 168, 201, 0.16);
    color: var(--text);
}

.btn-danger {
    background: rgba(255, 102, 117, 0.1);
    border-color: rgba(255, 102, 117, 0.22);
    color: #ffd2d7;
}

.btn-block {
    width: 100%;
}

.badge-accent {
    background: rgba(255, 135, 90, 0.12);
    border-color: rgba(255, 135, 90, 0.24);
}

.route-link {
    color: var(--accent);
    word-break: break-all;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(142, 168, 201, 0.1);
    vertical-align: top;
}

.table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.inline-editor {
    margin-top: 14px;
    border-top: 1px solid rgba(142, 168, 201, 0.12);
    padding-top: 14px;
}

.inline-editor summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    list-style: none;
}

.inline-editor summary::-webkit-details-marker {
    display: none;
}

.flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid;
}

.flash strong {
    min-width: 70px;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
}

.flash-success {
    background: rgba(52, 210, 143, 0.08);
    border-color: rgba(52, 210, 143, 0.25);
}

.flash-danger {
    background: rgba(255, 102, 117, 0.08);
    border-color: rgba(255, 102, 117, 0.25);
}

.flash-warning {
    background: rgba(243, 181, 75, 0.08);
    border-color: rgba(243, 181, 75, 0.25);
}

.compact {
    margin-bottom: 14px;
}

.empty-state {
    padding: 16px 0 4px;
}

.meter {
    height: 18px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(142, 168, 201, 0.12);
}

.meter-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
}

.bars {
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    align-items: end;
    min-height: 240px;
}

.bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bar-fill {
    width: 100%;
    min-height: 12px;
    border-radius: 16px 16px 8px 8px;
    background: linear-gradient(180deg, var(--accent), var(--accent-warm));
}

.bar strong {
    font-size: 0.76rem;
}

.bar span {
    color: var(--muted);
    font-size: 0.75rem;
}

.auth-body,
.plain-body {
    min-height: 100vh;
}

.auth-layout,
.center-shell,
.redirect-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 440px);
    gap: 24px;
    align-items: center;
}

.auth-shell--single {
    width: min(440px, 100%);
    grid-template-columns: 1fr;
}

.auth-copy {
    padding: 16px;
}

.auth-copy h1 {
    margin: 0 0 14px;
    font-size: clamp(2.2rem, 5vw, 4.6rem);
    line-height: 0.98;
}

.auth-copy p {
    max-width: 56ch;
    color: var(--muted);
    font-size: 1.03rem;
}

.auth-highlights {
    margin-top: 26px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-card--single {
    width: 100%;
}

.center-card,
.redirect-card {
    width: min(520px, 100%);
    text-align: center;
}

.redirect-card {
    position: relative;
    overflow: hidden;
}

.redirect-card.is-preview {
    border-color: rgba(243, 181, 75, 0.28);
    background:
        linear-gradient(180deg, rgba(243, 181, 75, 0.08), rgba(61, 213, 243, 0.04)),
        var(--panel);
}

.loader-ring {
    width: 82px;
    height: 82px;
    margin: 0 auto 18px;
    border-radius: 999px;
    border: 6px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

.redirect-progress {
    position: relative;
    height: 12px;
    margin: 18px 0 20px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
}

.redirect-progress-bar {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    animation: progress 1s ease forwards;
}

.redirect-progress-bar.is-paused {
    animation: none;
    transform: scaleX(0.58);
    opacity: 0.76;
}

.preview-banner,
.redirect-meta {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    text-align: left;
}

.preview-banner {
    border: 1px solid rgba(243, 181, 75, 0.28);
    background: rgba(243, 181, 75, 0.08);
}

.preview-banner strong,
.redirect-meta span {
    display: block;
    margin-bottom: 6px;
}

.preview-banner strong {
    color: var(--warning);
}

.redirect-meta {
    border: 1px solid rgba(142, 168, 201, 0.18);
    background: rgba(255, 255, 255, 0.03);
}

.redirect-meta code {
    display: block;
    color: var(--text);
    word-break: break-all;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.84rem;
    line-height: 1.5;
}

.icon-button {
    width: 48px;
    height: 48px;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.icon-button span {
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 999px;
}

.sidebar-backdrop {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes progress {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@media (max-width: 1120px) {
    .metric-grid,
    .content-grid,
    .auth-shell,
    .auth-highlights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 320px);
        transform: translateX(-104%);
        transition: transform 180ms ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(3px);
        z-index: 10;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .mobile-only,
    .icon-button {
        display: inline-flex;
    }
}

@media (max-width: 720px) {
    .page,
    .topbar {
        padding: 18px;
    }

    .metric-grid,
    .info-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-header,
    .panel-head,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-right {
        justify-content: space-between;
    }
}