:root {
    --background: #05070d;
    --background-soft: #0b0f18;
    --surface: rgba(15, 18, 26, 0.84);
    --surface-strong: rgba(16, 20, 28, 0.92);
    --surface-muted: rgba(22, 26, 36, 0.78);
    --surface-accent: rgba(25, 30, 42, 0.92);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f7f9fd;
    --text-muted: #9ca6b8;
    --primary: #f3f6fb;
    --primary-foreground: #080b12;
    --success: #6fcb8d;
    --warning: #d4a14b;
    --danger: #d66e6a;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
    --shadow-soft: 0 18px 34px rgba(0, 0, 0, 0.24);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 20px;
    --radius-sm: 16px;
    --input-height: 52px;
    --sidebar-width: 300px;
    --font-sans: "Bahnschrift", "Segoe UI Variable", "Segoe UI", sans-serif;
    --font-mono: "Cascadia Mono", "Consolas", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(
            circle at 14% 0%,
            rgba(255, 255, 255, 0.06),
            transparent 26%
        ),
        radial-gradient(
            circle at 88% 10%,
            rgba(255, 255, 255, 0.04),
            transparent 20%
        ),
        linear-gradient(180deg, #05070d 0%, #060911 52%, #05070d 100%);
    color: var(--text);
    font-family: var(--font-sans);
}

body {
    min-height: 100vh;
}

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

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

img {
    display: block;
    max-width: 100%;
}

::selection {
    background: rgba(241, 245, 251, 0.14);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(241, 245, 251, 0.18) transparent;
}

*::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(241, 245, 251, 0.14),
        rgba(130, 149, 183, 0.22)
    );
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(241, 245, 251, 0.22),
        rgba(130, 149, 183, 0.28)
    );
    border: 2px solid transparent;
    background-clip: padding-box;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.45rem;
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.05);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: 160ms ease;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.62rem;
    height: 0.38rem;
    border-left: 2px solid var(--primary-foreground);
    border-bottom: 2px solid var(--primary-foreground);
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 0.16s ease;
    margin-top: -1px;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: rgba(255, 255, 255, 0.45);
}

input[type="checkbox"]:checked::before {
    transform: rotate(-45deg) scale(1);
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

#app {
    min-height: 100vh;
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-card {
    width: min(100%, 520px);
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    border: 1px solid var(--border);
    border-radius: 34px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    padding: 32px;
}

.auth-brand,
.brand-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: grid;
    gap: 16px;
    padding: 20px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.035),
        rgba(255, 255, 255, 0.015)
    );
}

.brand-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(
            circle at 35% 30%,
            rgba(255, 255, 255, 0.14),
            transparent 56%
        ),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.08),
            rgba(255, 255, 255, 0.03)
        );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: brightness(1.65) contrast(1.15) grayscale(1);
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-subtitle,
.auth-subtitle,
.page-subtitle,
.card-subtitle,
.metric-footnote {
    color: var(--text-muted);
}

.brand-subtitle,
.auth-subtitle {
    line-height: 1.6;
}

.brand-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.auth-card h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 20px;
    padding: 18px;
}

.sidebar {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    border-radius: 32px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav-button {
    width: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 22px;
    background: transparent;
    color: var(--text-muted);
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
    transition: 180ms ease;
}

.nav-button::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    opacity: 0;
    background: linear-gradient(
        180deg,
        rgba(241, 245, 251, 0.8),
        rgba(160, 180, 214, 0.55)
    );
    transition: opacity 180ms ease;
}

.nav-button:hover,
.nav-button.active {
    color: var(--text);
    border-color: var(--border);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.055),
        rgba(255, 255, 255, 0.025)
    );
    transform: translateX(1px);
}

.nav-button.active::before,
.nav-button:hover::before {
    opacity: 1;
}

.nav-button strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-button span {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.5;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.7;
}

.content {
    min-width: 0;
    display: grid;
    gap: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 32px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.page-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    max-width: 760px;
}

.toolbar,
.badge-row,
.btn-row,
.inline-actions,
.preset-row,
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--text-muted);
}

.badge-dot.success {
    background: var(--success);
}

.badge-dot.warning {
    background: var(--warning);
}

.badge-dot.danger {
    background: var(--danger);
}

.page,
.grid,
.stack {
    display: grid;
    gap: 18px;
}

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

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

.split {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
}

.card {
    min-width: 0;
    padding: 22px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.probe-card .card-subtitle.compact,
.card-subtitle.compact {
    margin: 6px 0 0;
}

.card-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card-subtitle {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.6;
}

.metric-value {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.metric-footnote {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
}

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

.field {
    display: grid;
    gap: 8px;
}

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

.field label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.input,
.textarea,
.select {
    width: 100%;
    min-height: var(--input-height);
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-accent);
    color: var(--text);
    padding: 0 16px;
    outline: none;
    transition: 180ms ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.textarea {
    min-height: 136px;
    padding: 14px 16px;
    resize: vertical;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 14px) calc(50% - 3px);
    background-size:
        6px 6px,
        6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

.input:hover,
.textarea:hover,
.select:hover {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(31, 37, 51, 0.96);
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: rgba(243, 246, 251, 0.3);
    box-shadow: 0 0 0 4px rgba(243, 246, 251, 0.08);
    background: rgba(35, 42, 57, 0.96);
}

input[type="file"].input {
    padding: 10px 12px;
}

input[type="file"].input::file-selector-button {
    margin-right: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
}

.btn {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.03em;
    transition: 180ms ease;
}

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

.btn.primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 18px 36px rgba(243, 246, 251, 0.1);
}

.btn.secondary {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.btn.warning {
    color: #ffe1b3;
    border-color: rgba(212, 161, 75, 0.24);
    background: rgba(212, 161, 75, 0.14);
}

.btn.danger {
    color: #ffd4d1;
    border-color: rgba(214, 110, 106, 0.24);
    background: rgba(214, 110, 106, 0.14);
}

.btn.success {
    color: #d4f4de;
    border-color: rgba(111, 203, 141, 0.24);
    background: rgba(111, 203, 141, 0.14);
}

.btn:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    transform: none;
}

.table-wrap {
    overflow: auto;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

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

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.table tr:last-child td {
    border-bottom: none;
}

.copy-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.028);
}

.copy-value,
.code {
    font-family: var(--font-mono);
}

.copy-value {
    flex: 1;
    min-width: 220px;
    overflow-wrap: anywhere;
    font-size: 12px;
}

.token-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mini-stat {
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.mini-stat-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mini-stat strong {
    display: block;
    font-size: 16px;
    line-height: 1.4;
    word-break: break-word;
}

.qr-setup {
    display: flex;
    gap: 18px;
    align-items: stretch;
    flex-wrap: wrap;
}

.qr-card {
    width: min(100%, 264px);
    min-height: 292px;
    padding: 18px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.035),
        rgba(255, 255, 255, 0.015)
    );
    display: grid;
    gap: 14px;
    align-content: start;
}

.qr-card-header {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.qr-frame {
    display: grid;
    place-items: center;
    min-height: 210px;
    padding: 16px;
    border-radius: 22px;
    background: #ffffff;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 12px 30px rgba(0, 0, 0, 0.16);
}

.qr-card svg,
.qr-frame svg {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    shape-rendering: crispEdges;
}

.qr-copy-block {
    min-width: min(100%, 320px);
}

.chart-card {
    display: grid;
    gap: 14px;
}

.chart-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chart-summary strong {
    color: var(--text);
    font-size: 24px;
    letter-spacing: 0.02em;
}

.chart-surface {
    min-height: 184px;
    padding: 12px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.03),
            rgba(255, 255, 255, 0.015)
        ),
        rgba(255, 255, 255, 0.012);
}

.chart-svg {
    width: 100%;
    height: 160px;
    display: block;
}

.chart-axis {
    stroke: rgba(154, 167, 190, 0.32);
    stroke-width: 0.8;
}

.chart-line {
    fill: none;
    stroke: rgba(241, 245, 251, 0.92);
    stroke-width: 2;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.empty,
.loading {
    display: grid;
    place-items: center;
    min-height: 140px;
    padding: 18px;
    border-radius: 22px;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
}

.empty.compact {
    min-height: 0;
    padding: 14px;
}

.loading {
    min-height: 220px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.code {
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(4, 7, 14, 0.88);
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 640px;
    overflow: auto;
}

.pill.running,
.pill.completed,
.pill.active {
    color: #d5f5df;
    border-color: rgba(111, 203, 141, 0.28);
    background: rgba(111, 203, 141, 0.14);
}

.pill.failed,
.pill.error,
.pill.revoked {
    color: #ffd2ce;
    border-color: rgba(214, 110, 106, 0.28);
    background: rgba(214, 110, 106, 0.14);
}

.pill.warning {
    color: #ffe1b3;
    border-color: rgba(212, 161, 75, 0.26);
    background: rgba(212, 161, 75, 0.12);
}

.pill.queued,
.pill.info,
.pill.unresolved {
    color: #e4ecff;
    border-color: rgba(173, 190, 223, 0.22);
    background: rgba(173, 190, 223, 0.12);
}

.toast-root {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 90;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(14, 18, 26, 0.94);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.toast.success {
    border-color: rgba(111, 203, 141, 0.28);
}

.toast.error {
    border-color: rgba(214, 110, 106, 0.28);
}

.toast.warning {
    border-color: rgba(212, 161, 75, 0.28);
}

@media (max-width: 1260px) {
    .grid.three,
    .grid.two,
    .split {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        position: static;
        height: auto;
    }
}

@media (max-width: 760px) {
    .shell {
        padding: 14px;
    }

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

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

    .auth-card,
    .card,
    .sidebar,
    .topbar {
        padding: 18px;
        border-radius: 24px;
    }

    .qr-card {
        width: 100%;
        min-height: 0;
    }

    .page-title {
        font-size: 24px;
    }

    .metric-value {
        font-size: 28px;
    }
}
