/* Workspaces: account settings and the admin area share one theme (the sign
   in, sign up and other auth pages use the same page background).
   Both pages are a sidebar of links next to a content column that opens with
   a plain heading, then panels and overview cards. The tokens (--ws-*) are in
   base.css; account.css and the admin* stylesheets only add what their pages
   need on top of this file. */
.admin-page,
.account-settings-page,
.auth-page {
    position: relative;
    overflow-x: clip;
    color: #fff;
    background:
        radial-gradient(circle at 85% 0, rgba(var(--ch-accent-rgb), 0.07), transparent 32%),
        var(--ch-surface-1);
}

.admin-body,
.account-body,
.auth-body {
    color: #fff;
    background: var(--ch-surface-2);
}

/* Layout: the same gutters and width on both, and a fixed sidebar column
   next to the content from 992px (account settings from 768px) */
.admin-shell,
.account-settings-shell {
    position: relative;
    z-index: 1;
    max-width: none;
    padding: var(--ch-section-space-sm) var(--ch-bleed-gutter) var(--ch-section-space) !important;
}

.admin-layout,
.account-settings-layout {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    row-gap: var(--ws-gap);
    max-width: 1640px;
    margin: 0 auto;
}

@media (max-width: 767.98px) {
    .admin-shell,
    .account-settings-shell {
        padding-top: 28px !important;
        padding-bottom: 64px !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .account-settings-layout {
        display: grid;
        grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
        column-gap: 24px;
        align-items: start;
    }

    .account-settings-layout > * {
        width: auto;
        margin-bottom: 0 !important;
    }
}

@media (min-width: 992px) {
    .admin-layout,
    .account-settings-layout {
        --bs-gutter-x: 0;
        --bs-gutter-y: 0;
        display: grid;
        grid-template-columns: var(--ws-sidebar-width) minmax(0, 1fr);
        column-gap: clamp(24px, 2.6vw, 40px);
        align-items: start;
    }

    .admin-layout > *,
    .account-settings-layout > * {
        width: auto;
        margin-bottom: 0 !important;
    }

    .admin-sidebar-column,
    .account-settings-nav-column {
        position: sticky;
        top: 24px;
    }

    .admin-sidebar,
    .account-settings-sidebar {
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        scrollbar-color: var(--ch-surface-6) transparent;
        scrollbar-width: thin;
    }
}

/* Sidebar */
.admin-sidebar,
.account-settings-sidebar {
    padding: 14px;
    border: 1px solid var(--ws-panel-border);
    border-radius: var(--ws-panel-radius);
    background: var(--ch-surface-2);
    box-shadow: var(--ws-panel-shadow);
}

.admin-nav-label,
.account-settings-label {
    display: block;
    margin: 4px 10px 8px;
    color: var(--ch-text-subtle);
    font-size: var(--ch-text-xs);
    font-weight: var(--ch-weight-heavy);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-sidebar > a,
.admin-sidebar .ms-3 a,
.account-settings-link {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
    padding: 8px 10px;
    color: var(--ch-text-muted);
    font-size: var(--ch-text-md);
    font-weight: var(--ch-weight-medium);
    line-height: 1.3;
    text-decoration: none;
    border-radius: var(--ch-radius-sm);
    transition: color var(--ch-transition), background-color var(--ch-transition);
}

.admin-sidebar > a:hover,
.admin-sidebar .ms-3 a:hover,
.account-settings-link:hover,
.account-settings-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.admin-sidebar > a.bg-secondary,
.account-settings-link.active {
    color: var(--ch-on-accent);
    background: var(--ch-accent) !important;
}

/* Page heading */
.admin-content-heading,
.account-settings-heading {
    max-width: none;
    margin-bottom: var(--ws-gap);
    padding-bottom: clamp(16px, 2vw, 22px);
    border-bottom: 1px solid var(--ch-border-subtle);
}

.admin-content-heading > span,
.account-settings-heading > span {
    display: block;
    margin-bottom: 8px;
    color: var(--ch-accent);
    font-size: var(--ch-text-xs);
    font-weight: var(--ch-weight-heavy);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-content-heading h1,
.account-settings-heading h1 {
    margin: 0 0 6px;
    font-size: clamp(1.6rem, 1.25rem + 1.1vw, 2.2rem);
    font-weight: var(--ch-weight-heavy);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.admin-content-heading p,
.account-settings-heading p {
    max-width: 720px;
    margin: 0;
    color: var(--ch-text-muted);
    font-size: var(--ch-text-body);
    line-height: 1.6;
}

/* Panels */
.admin-content .card,
.admin-content .bg-dark.rounded,
.account-settings-card {
    color: #fff !important;
    border: 1px solid var(--ws-panel-border) !important;
    border-radius: var(--ws-panel-radius) !important;
    background: var(--ws-panel-bg) !important;
    box-shadow: var(--ws-panel-shadow);
}

.admin-content .card-body,
.account-settings-card .card-body {
    padding: var(--ws-panel-padding);
}

/* Overview cards: one per area, with its number in the corner */
.admin-command-grid,
.account-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ws-gap);
}

.admin-command-card,
.account-overview-card {
    position: relative;
    display: flex;
    min-height: 220px;
    flex-direction: column;
    align-items: flex-start;
    padding: var(--ws-panel-padding);
    color: #fff;
    text-decoration: none;
    border: 1px solid var(--ws-panel-border);
    border-radius: var(--ws-panel-radius);
    background: var(--ws-panel-bg);
    box-shadow: var(--ws-panel-shadow);
    transition: border-color var(--ch-transition), background-color var(--ch-transition);
}

a.admin-command-card:hover,
a.admin-command-card:focus-visible,
a.account-overview-card:hover,
a.account-overview-card:focus-visible {
    color: #fff;
    border-color: rgba(var(--ch-accent-rgb), 0.45);
    background: var(--ch-surface-4);
}

.admin-command-card > span,
.account-overview-card > span {
    position: absolute;
    top: var(--ws-panel-padding);
    right: var(--ws-panel-padding);
    color: var(--ch-text-subtle);
    font-size: var(--ch-text-xs);
    font-weight: var(--ch-weight-heavy);
    letter-spacing: 0.14em;
}

html[dir="rtl"] .admin-command-card > span,
html[dir="rtl"] .account-overview-card > span {
    right: auto;
    left: var(--ws-panel-padding);
}

.admin-command-card h2,
.account-overview-card h2 {
    margin: 0 0 6px;
    padding-inline-end: 36px;
    font-size: 1.2rem;
    font-weight: var(--ch-weight-bold);
    letter-spacing: -0.02em;
}

.admin-command-card > svg + h2 {
    margin-top: 22px;
}

.admin-command-card p,
.account-overview-card p {
    max-width: 420px;
    margin: 0 0 20px;
    color: var(--ch-text-muted);
    font-size: var(--ch-text-sm);
    line-height: 1.6;
}

.admin-command-card > strong,
.account-overview-card > strong {
    margin-top: auto;
    color: var(--ch-text-soft);
    font-size: var(--ch-text-sm);
    font-weight: var(--ch-weight-bold);
}

a.account-overview-card:hover > strong,
a.account-overview-card:focus-visible > strong {
    color: var(--ch-accent);
}

@media (max-width: 767.98px) {
    .admin-command-grid,
    .account-overview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-command-card,
    .account-overview-card {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .admin-sidebar a,
    .account-settings-link,
    .admin-command-card,
    .account-overview-card {
        transition: none;
    }
}
