.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.topbar>div:first-child {
    min-width: 150px;
}

.topbar p {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0;
}

.identity-panel {
    max-width: 760px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 14px 18px;
}

.identity-panel div {
    min-width: 160px;
    display: grid;
    gap: 3px;
}

.identity-actions {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px !important;
}

.identity-panel strong {
    color: var(--text);
    font-size: 13px;
}

.identity-panel span {
    color: var(--warn);
    font-size: 12px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.topbar-nav[hidden] {
    display: none !important;
}

.shell {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    min-height: calc(100vh - 72px);
}

.rail {
    padding: 14px;
    background: #fff;
    border-right: 1px solid var(--line);
}

.content {
    padding: 20px;
    max-width: 1180px;
    width: 100%;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

@media (max-width: 820px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .rail {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .topbar {
        flex-wrap: wrap;
    }

    .identity-panel {
        align-items: flex-start;
        flex-direction: column;
        justify-content: flex-start;
    }

    .identity-actions {
        justify-content: flex-start;
    }

    .topbar-nav {
        order: 4;
        width: 100%;
        justify-content: flex-start;
    }

    .nav {
        min-width: 110px;
    }

    .account-panel {
        grid-template-columns: 1fr;
    }

    .api-key-form,
    .api-key-card {
        grid-template-columns: 1fr;
    }

    .api-key-actions {
        justify-content: flex-start;
    }
}