/* ── Shared app sidebar layout ───────────────────────────────── */

.app-layout,
.db-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--top-bar-h, 60px));
    background: var(--bg, #f8f9fa);
}

.app-layout > .app-sidebar,
.db-layout > .app-sidebar {
    display: none;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    line-height: 1.2;
}

.app-layout > .app-content,
.db-layout > .db-content {
    flex: 1;
    min-width: 0;
}

@media (min-width: 900px) {
    .app-layout > .app-sidebar,
    .db-layout > .app-sidebar {
        display: flex !important;
        flex-direction: column;
        width: 220px;
        flex-shrink: 0;
        background: var(--card-bg);
        border-right: 1px solid var(--border);
        min-height: calc(100vh - var(--top-bar-h, 60px));
        /* Cap as well as floor, or overflow-y below can never engage: the
           sidebar just grows past the viewport and you scroll the page to
           reach the last item. */
        max-height: calc(100vh - var(--top-bar-h, 60px));
        padding: 14px 10px;
        gap: 2px;
        position: sticky;
        top: var(--top-bar-h, 60px);
        overflow-y: auto;
    }
}

/* ── Nav items ── */
.app-layout > .app-sidebar .app-nav-item,
.app-layout > .app-sidebar .app-nav-item:visited,
.db-layout > .app-sidebar .app-nav-item,
.db-layout > .app-sidebar .app-nav-item:visited {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text) !important;
    text-decoration: none !important;
    transition: background 0.12s, color 0.12s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
}

.app-layout > .app-sidebar .app-nav-item:hover,
.db-layout > .app-sidebar .app-nav-item:hover {
    background: var(--bg);
    color: var(--text) !important;
    text-decoration: none !important;
}

/* --tint-info/--on-tint-info, not --primary-color-light/--primary-color: full-strength
   hue on a pale wash of itself measured 3.18:1 on the active row. */
.app-layout > .app-sidebar .app-nav-item.active,
.db-layout > .app-sidebar .app-nav-item.active {
    background: var(--tint-info);
    color: var(--on-tint-info) !important;
    font-weight: 600;
}

/* Per-section accent, matching the mobile drawer (app-bottom-nav.css) so the same
   destination is the same colour on both surfaces. Icons only — the label stays
   full-strength --text so nothing depends on the hue for legibility. */
/* The sidebar is a flex column with gap:2px. Wrapping items in a group made that
   gap apply between groups instead of between items, so the group re-declares it. */
/* Accent pair comes from tokens.css via data-nav-section. */
.app-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-layout > .app-sidebar .app-nav-item i,
.db-layout > .app-sidebar .app-nav-item i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--nav-ink);
}

/* Only .active takes the item's colour. :hover used to as well, which wiped the
   section accent off the icon on the way past every row. */
.app-layout > .app-sidebar .app-nav-item.active i,
.db-layout > .app-sidebar .app-nav-item.active i {
    color: inherit;
}

.app-layout > .app-sidebar .app-nav-dot,
.db-layout > .app-sidebar .app-nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-left: auto;
    flex-shrink: 0;
}

.app-layout > .app-sidebar .app-nav-divider,
.db-layout > .app-sidebar .app-nav-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.app-layout > .app-sidebar .app-nav-section-label,
.db-layout > .app-sidebar .app-nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--nav-ink);
    padding: 2px 10px 4px;
}

/* ── User chip at bottom ── */
.app-layout > .app-sidebar .app-sidebar-user,
.db-layout > .app-sidebar .app-sidebar-user {
    margin-top: auto;
    padding: 9px 10px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
}

.app-layout > .app-sidebar .app-sidebar-avatar,
.db-layout > .app-sidebar .app-sidebar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f78929, #e7973c);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.app-layout > .app-sidebar .app-sidebar-name,
.db-layout > .app-sidebar .app-sidebar-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    font-family: 'Inter', sans-serif;
}

.app-nav-item.pro-locked {
    opacity: 0.45;
    pointer-events: auto;
}

.app-nav-item.pro-locked .app-nav-pro-lock {
    margin-left: auto;
    font-size: 0.65rem;
}
