:root {
    --bg: #f4f7fb;
    --bg-glow-1: rgba(37, 99, 235, 0.12);
    --bg-glow-2: rgba(20, 184, 166, 0.08);
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-soft: #f8fafc;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --muted: #64748b;
    --muted-strong: #475569;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #15803d;
    --success-soft: #dcfce7;
    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --danger-soft: #fef2f2;
    --code-bg: #0b1220;
    --code-text: #dbeafe;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 14px 40px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 70px rgba(15, 23, 42, .12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 30px;
}

html[data-theme="dark"] {
    --bg: #07101f;
    --bg-glow-1: rgba(37, 99, 235, 0.18);
    --bg-glow-2: rgba(20, 184, 166, 0.10);
    --surface: rgba(15, 23, 42, 0.88);
    --surface-solid: #0f172a;
    --surface-soft: #111c30;
    --surface-hover: #18243a;
    --text: #e5edf8;
    --muted: #94a3b8;
    --muted-strong: #cbd5e1;
    --border: #24324a;
    --border-strong: #334155;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-soft: rgba(59, 130, 246, .14);
    --success: #4ade80;
    --success-soft: rgba(34, 197, 94, .12);
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: rgba(239, 68, 68, .12);
    --code-bg: #020617;
    --code-text: #dbeafe;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-md: 0 14px 40px rgba(0, 0, 0, .28);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .34);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 4% -10%, var(--bg-glow-1), transparent 34rem),
        radial-gradient(circle at 96% 0%, var(--bg-glow-2), transparent 32rem),
        var(--bg);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

svg {
    display: block;
}

.page-shell {
    width: min(1220px, calc(100% - 36px));
    margin: 0 auto;
}

.topbar {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #2563eb, #4f46e5);
    color: #fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
}

.brand-mark svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

.brand > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.brand strong {
    font-size: 16px;
    letter-spacing: -.01em;
}

.brand small {
    max-width: min(48vw, 440px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface);
    color: var(--muted-strong);
    cursor: pointer;
    transition: .18s ease;
}

.icon-button:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
    color: var(--text);
}

.theme-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .theme-icon-moon {
    display: block;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 700;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.status-success {
    border-color: rgba(34, 197, 94, .25);
    color: var(--success);
    background: var(--success-soft);
}

.status-success .status-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

.main-content {
    padding: 10px 0 48px;
}

.hero-card,
.section-card,
.toolbar-card,
.error-card {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.hero-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(270px, .75fr);
    gap: 34px;
    padding: 42px;
    border-radius: var(--radius-xl);
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -100px;
    top: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .14), transparent 68%);
    pointer-events: none;
}

.hero-copy,
.hero-side {
    position: relative;
    z-index: 1;
}

.eyebrow,
.section-kicker {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.eyebrow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.hero-card h1,
.error-card h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.02;
    letter-spacing: -.045em;
}

.hero-description {
    max-width: 760px;
    margin: 18px 0 0;
    color: var(--muted-strong);
    font-size: 17px;
    line-height: 1.7;
}

.identity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 26px;
}

.avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), #4f46e5);
    color: #fff;
    font-weight: 800;
}

.identity-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.identity-text strong {
    font-size: 15px;
}

.identity-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 13px;
}

.hero-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.trust-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(34, 197, 94, .25);
    border-radius: 18px;
    background: var(--success-soft);
    color: var(--success);
}

.trust-card > div {
    display: flex;
    flex-direction: column;
}

.trust-card strong {
    font-size: 14px;
}

.trust-card span:last-child {
    color: var(--muted-strong);
    font-size: 12px;
    margin-top: 2px;
}

.trust-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(34, 197, 94, .14);
}

.trust-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.muted-line {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.metric-card {
    position: relative;
    min-height: 132px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 14px;
    color: var(--text);
    font-size: 15px;
    font-weight: 750;
}

.metric-number {
    margin-top: 8px;
    font-size: 31px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.metric-protocol {
    font-size: 24px;
}

.metric-hint {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.mono,
code,
pre {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

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

.text-action {
    position: absolute;
    left: 20px;
    bottom: 14px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.toolbar-card {
    margin-top: 14px;
    padding: 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.toolbar-copy {
    min-width: 180px;
    display: flex;
    flex-direction: column;
}

.toolbar-copy strong {
    font-size: 14px;
}

.toolbar-copy span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.button {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface-solid);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: .18s ease;
}

.button:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

.button svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}

.button-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

.button-danger:hover {
    border-color: var(--danger-hover);
    background: var(--danger-hover);
}

.button-large {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 13px;
    font-size: 14px;
}

.section-card {
    margin-top: 14px;
    padding: 28px;
    border-radius: var(--radius-lg);
}

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

.section-heading h2 {
    margin: 4px 0 0;
    font-size: 25px;
    letter-spacing: -.025em;
}

.section-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.endpoint-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
}

.endpoint-row {
    min-height: 58px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.endpoint-row:last-child {
    border-bottom: 0;
}

.endpoint-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.endpoint-row code {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-strong);
    font-size: 13px;
}

.copy-icon,
.inline-link {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.search-wrap {
    width: min(340px, 100%);
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 18px;
    height: 18px;
    fill: var(--muted);
    transform: translateY(-50%);
}

.search-wrap input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--surface-solid);
    color: var(--text);
    transition: .18s ease;
}

.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}

.table-shell {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
}

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

.claims-table thead {
    background: var(--surface-soft);
}

.claims-table th {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .065em;
    text-align: left;
    text-transform: uppercase;
}

.claims-table td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

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

.claims-table tbody tr {
    transition: background .15s ease;
}

.claims-table tbody tr:hover {
    background: var(--surface-soft);
}

.claim-name {
    max-width: 470px;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.claim-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.value-chip {
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid rgba(37, 99, 235, .12);
    border-radius: 999px;
    overflow-wrap: anywhere;
    background: var(--primary-soft);
    color: var(--muted-strong);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.table-action-column {
    width: 72px;
    text-align: right !important;
}

.empty-inline,
.no-results {
    padding: 28px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.raw-panel pre {
    max-height: 520px;
    margin: 0;
    padding: 20px;
    overflow: auto;
    border-radius: 14px;
    background: var(--code-bg);
    color: var(--code-text);
    font-size: 12px;
    line-height: 1.65;
}

.hero-buttons {
    margin-top: 28px;
}

.signed-out-visual {
    min-height: 220px;
    display: grid;
    place-items: center;
}

.protocol-flow {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(90px, 1fr) 80px minmax(90px, 1fr);
    align-items: center;
}

.flow-node {
    min-width: 0;
    padding: 18px 14px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.flow-node > span {
    width: 52px;
    height: 52px;
    margin: 0 auto 10px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 900;
}

.flow-node small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.flow-node-b2c > span {
    background: var(--success-soft);
    color: var(--success);
}

.flow-line {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.flow-line span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-strong);
}

.error-card {
    width: min(780px, 100%);
    margin: 70px auto 0;
    padding: 34px;
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 24px;
}

.error-icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 28px;
    font-weight: 900;
}

.error-card h1 {
    margin-top: 7px;
    font-size: clamp(30px, 5vw, 43px);
}

.error-card p {
    color: var(--muted-strong);
}

.error-details {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.error-details ul {
    margin-bottom: 0;
}

.footer {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    font-size: 12px;
}

.footer > div:first-child {
    display: flex;
    flex-direction: column;
}

.footer strong {
    color: var(--muted-strong);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links a {
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1000;
    padding: 11px 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--text);
    color: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: .2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

[hidden] {
    display: none !important;
}

@media (max-width: 980px) {
    .hero-card {
        grid-template-columns: 1fr;
    }

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

    .toolbar-card,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-wrap {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100% - 22px, 1220px);
    }

    .topbar {
        min-height: 74px;
    }

    .brand small,
    .status-pill {
        display: none;
    }

    .main-content {
        padding-top: 4px;
    }

    .hero-card {
        padding: 26px 22px;
        border-radius: 22px;
    }

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

    .metric-card {
        min-height: 118px;
    }

    .section-card {
        padding: 20px;
    }

    .endpoint-row {
        grid-template-columns: 1fr auto;
    }

    .endpoint-label {
        grid-column: 1 / -1;
    }

    .claims-heading {
        margin-bottom: 16px;
    }

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

    .claims-table {
        min-width: 700px;
    }

    .protocol-flow {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .flow-line {
        transform: rotate(90deg);
    }

    .error-card {
        margin-top: 24px;
        grid-template-columns: 1fr;
    }

    .footer {
        padding: 24px 0;
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
