:root {
    --radius: 10px;
    --radius-sm: 7px;
    --radius-pill: 100px;
    --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, sans-serif;
    --sidebar: #080809;
    --bg: #0c0d0e;
    --surface: #121315;
    --surface-2: #1b1d1f;
    --border: #222427;
    --text: #e2e5e7;
    --text-dim: #8a9097;
    --text-mute: #585d63;
    --accent: #708b94;
    --accent-dim: #5c727a;
    --ok-bg: #273328;
    --ok-fg: #83c79a;
    --warn-bg: #342f22;
    --warn-fg: #d9b36b;
    --err-bg: #352727;
    --err-fg: #d98b8b;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.heading {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sub {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.5;
}

.label-caps {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.text-dim {
    color: var(--text-dim);
}

.text-mute {
    color: var(--text-mute);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}

.card-lg {
    padding: 32px 30px;
}

.brand-mark {
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-mute);
    letter-spacing: 0.1em;
    margin-top: 2px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 15px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}

    .btn:hover {
        background: var(--accent-dim);
    }

    .btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

    .btn-ghost:hover {
        background: var(--surface-2);
        color: var(--text);
    }

.btn-block {
    width: 100%;
    padding: 11px 15px;
    font-size: 13.5px;
}

.field {
    margin-bottom: 16px;
}

    .field > label {
        display: block;
        font-size: 12px;
        color: var(--text-dim);
        margin-bottom: 7px;
    }

.input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 11px 13px;
    font-size: 13.5px;
    font-family: var(--font);
}

    .input::placeholder {
        color: var(--text-mute);
    }

    .input:focus {
        outline: none;
        border-color: var(--accent);
    }

.input-search {
    background: var(--surface);
}

.input-code {
    letter-spacing: 0.5em;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-ok {
    background: var(--ok-bg);
    color: var(--ok-fg);
}

.badge-warn {
    background: var(--warn-bg);
    color: var(--warn-fg);
}

.badge-err {
    background: var(--err-bg);
    color: var(--err-fg);
}

.badge-mute {
    background: var(--surface-2);
    color: var(--text-dim);
}

.chip-kv {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 13px;
}

    .chip-kv .k {
        color: var(--text-mute);
    }

    .chip-kv .v {
        color: var(--text);
        font-weight: 500;
    }

.form-error {
    font-size: 12px;
    color: var(--err-fg);
    margin-top: 12px;
    min-height: 16px;
    text-align: center;
}

.stack-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.full {
    width: 100%;
}

.mt-1 {
    margin-top: 10px;
}

.mb-1 {
    margin-bottom: 22px;
}

.auth-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 40px 20px;
}

.auth-stage {
    width: 100%;
    max-width: 380px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    text-align: center;
}

    .auth-brand .brand-mark {
        width: 46px;
        height: 46px;
        font-size: 17px;
    }

    .auth-brand .brand-name {
        font-size: 17px;
    }

.auth-footer-note {
    font-size: 11px;
    color: var(--text-mute);
    text-align: center;
    max-width: 380px;
    line-height: 1.6;
}

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 18px;
}

    .sidebar-brand .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

.nav-cat {
    font-size: 10px;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--text-mute);
    padding: 16px 10px 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
}

    .nav-item:hover {
        background: var(--surface);
        color: var(--text);
    }

    .nav-item.active {
        background: var(--surface-2);
        color: var(--text);
    }

        .nav-item.active svg {
            color: var(--accent);
        }

    .nav-item svg {
        width: 17px;
        height: 17px;
        flex-shrink: 0;
        color: var(--text-mute);
    }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 22px;
    gap: 14px;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.topbar-spacer {
    flex: 1;
}

.user-menu {
    position: relative;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-dim);
    background: transparent;
    border: none;
    font-family: var(--font);
    cursor: pointer;
    padding: 5px 7px;
    border-radius: var(--radius-sm);
}

    .user-chip:hover {
        background: var(--surface-2);
        color: var(--text);
    }

    .user-chip .avatar {
        width: 28px;
        height: 28px;
        border-radius: var(--radius-sm);
        background: var(--surface-2);
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 600;
    }

    .user-chip .chevron {
        width: 14px;
        height: 14px;
        color: var(--text-mute);
    }

.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}

    .menu-item:hover {
        background: var(--surface-2);
        color: var(--text);
    }

    .menu-item svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        color: var(--text-mute);
    }

.menu-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.notfound-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 20px;
    text-align: center;
}

.notfound-code {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
    line-height: 1;
}

.notfound-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.notfound-text {
    font-size: 13.5px;
    color: var(--text-dim);
    max-width: 360px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.icon {
    font-size: 17px;
    line-height: 1;
    color: var(--text-mute);
    flex-shrink: 0;
    vertical-align: middle;
}

.icon-sm {
    font-size: 16px;
}

.icon-accent {
    color: var(--accent);
}

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

    .page-head .page-title {
        font-size: 18px;
        font-weight: 600;
    }

    .page-head .page-sub {
        font-size: 12.5px;
        color: var(--text-dim);
        margin-top: 3px;
    }

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

    .toolbar .input-search {
        flex: 1;
        min-width: 220px;
        max-width: 360px;
        padding: 9px 12px;
        font-size: 13px;
    }

.filters {
    display: flex;
    gap: 7px;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px 13px;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
    font-family: var(--font);
}

    .chip:hover {
        color: var(--text);
        border-color: var(--text-mute);
    }

    .chip.active {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--accent);
    }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .table thead th {
        text-align: left;
        font-weight: 500;
        color: var(--text-mute);
        font-size: 11px;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        padding: 11px 16px;
        border-bottom: 1px solid var(--border);
        background: var(--surface-2);
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
    }

        .table thead th .arrow {
            color: var(--accent);
            margin-left: 4px;
            font-size: 10px;
        }

    .table tbody td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        color: var(--text-dim);
    }

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

    .table tbody tr {
        cursor: pointer;
    }

        .table tbody tr:hover td {
            background: var(--surface-2);
        }

    .table td.id {
        color: var(--text-mute);
        font-variant-numeric: tabular-nums;
    }

    .table td.strong {
        color: var(--text);
        font-weight: 500;
    }

.cell-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

    .cell-user .avatar {
        width: 26px;
        height: 26px;
        border-radius: var(--radius-sm);
        background: var(--surface-2);
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        font-weight: 600;
        flex-shrink: 0;
    }

.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-mute);
}

.pager {
    display: flex;
    gap: 6px;
}

    .pager button {
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text-dim);
        border-radius: var(--radius-sm);
        padding: 5px 10px;
        font-size: 12px;
        cursor: pointer;
        font-family: var(--font);
    }

        .pager button:hover {
            color: var(--text);
            border-color: var(--text-mute);
        }

        .pager button.active {
            background: var(--surface-2);
            color: var(--text);
            border-color: var(--accent);
        }

.empty-state {
    padding: 48px 16px;
    text-align: center;
    color: var(--text-mute);
    font-size: 13px;
}

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: var(--font);
}

    .tab:hover {
        color: var(--text);
    }

    .tab.active {
        color: var(--text);
        border-bottom-color: var(--accent);
    }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px 24px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .detail-row .k {
        font-size: 11px;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-mute);
    }

    .detail-row .v {
        font-size: 13.5px;
        color: var(--text);
    }

        .detail-row .v.muted {
            color: var(--text-mute);
        }

.role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

    .role-tag.primary {
        color: var(--text);
        border-color: var(--accent);
    }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0 24px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 11px 13px;
    font-size: 13.5px;
    font-family: var(--font);
}

    .select:focus {
        outline: none;
        border-color: var(--accent);
    }

.switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    color: var(--text-dim);
}

.switch {
    position: relative;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    transition: background 0.15s ease, border-color 0.15s ease;
}

    .switch .knob {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--text-mute);
        transition: transform 0.15s ease, background 0.15s ease;
    }

.switch-wrap.on .switch {
    background: var(--accent);
    border-color: var(--accent);
}

    .switch-wrap.on .switch .knob {
        transform: translateX(16px);
        background: var(--bg);
    }

.switch-wrap.on {
    color: var(--text);
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
}

    .check-row:hover {
        background: var(--surface-2);
    }

    .check-row input[type="checkbox"] {
        appearance: none;
        width: 17px;
        height: 17px;
        flex-shrink: 0;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 5px;
        cursor: pointer;
        position: relative;
    }

        .check-row input[type="checkbox"]:checked {
            background: var(--accent);
            border-color: var(--accent);
        }

            .check-row input[type="checkbox"]:checked::after {
                content: "";
                position: absolute;
                left: 5px;
                top: 1px;
                width: 4px;
                height: 9px;
                border: solid var(--bg);
                border-width: 0 2px 2px 0;
                transform: rotate(45deg);
            }

    .check-row .scope-key {
        font-size: 13px;
        color: var(--text);
    }

    .check-row .scope-desc {
        font-size: 12px;
        color: var(--text-mute);
        margin-left: auto;
    }

.key-reveal {
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 13px;
    color: var(--text);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 12px;
}

    .key-reveal code {
        flex: 1;
    }

.key-warn {
    font-size: 12.5px;
    color: var(--warn-fg);
    background: var(--warn-bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 14px;
    line-height: 1.5;
}

.method-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    background: var(--surface-2);
    color: var(--text-dim);
}

.method-get {
    color: #83c79a;
}

.method-post {
    color: #7fa6d9;
}

.method-put {
    color: #d9b36b;
}

.method-patch {
    color: #c79ad9;
}

.method-delete {
    color: #d98b8b;
}

.mono {
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 12.5px;
}

.cell-path {
    color: var(--text);
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 12.5px;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 12.5px;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 340px;
    overflow-y: auto;
    margin: 0;
}

    .code-block.empty {
        color: var(--text-mute);
        font-style: italic;
    }

.detail-section {
    margin-bottom: 18px;
}

    .detail-section > .k {
        display: block;
        font-size: 11px;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-mute);
        margin-bottom: 7px;
    }

th.sortable {
    cursor: pointer;
}

    th.sortable.sorted {
        color: var(--text-dim);
    }

.rr-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .rr-split {
        grid-template-columns: 1fr;
    }
}

.rr-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rr-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-mute);
}

    .rr-panel-head .spacer {
        flex: 1;
    }

.rr-body {
    padding: 14px 16px;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 12.5px;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 520px;
    margin: 0;
    line-height: 1.55;
}

.rr-startline {
    color: var(--text);
    font-weight: 600;
}

.rr-sep {
    display: block;
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}

.rr-empty {
    color: var(--text-mute);
    font-style: italic;
}

.meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

    .meta-bar .meta {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

        .meta-bar .meta .k {
            font-size: 10px;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-mute);
        }

        .meta-bar .meta .v {
            font-size: 13px;
            color: var(--text);
        }

            .meta-bar .meta .v.mono {
                font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
                font-size: 12.5px;
            }

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-bottom: 20px;
}

    .stepper .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--surface-2);
        border: 1px solid var(--border);
        transition: background 0.15s ease, border-color 0.15s ease;
    }

        .stepper .dot.done {
            background: var(--accent-dim);
            border-color: var(--accent-dim);
        }

        .stepper .dot.current {
            background: var(--accent);
            border-color: var(--accent);
        }

.step-label {
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 18px;
}

.qr-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 0 auto 18px;
    width: 186px;
    min-width: 186px;
    height: 186px;
}

    .qr-frame img {
        display: block;
        width: 200px;
        height: 200px;
        image-rendering: pixelated;
    }

.recovery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.recovery-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 13px;
    color: var(--text);
    text-align: center;
    letter-spacing: 0.04em;
}

.onboarding-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 12px 0;
}

    .onboarding-success .ok-mark {
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: #1e2a22;
        border: 1px solid #2e4335;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .onboarding-success .ok-mark svg {
            width: 26px;
            height: 26px;
            color: #83c79a;
        }
