/* dash-shell.css — the SecurityAlert .dash/.side app layout, applied to
 * ServiceAlert's shell classes (.settings-layout/.settings-sidebar/
 * .settings-main) so every authed page adopts it without markup edits.
 *
 * v3 (2026-07-26): all sidebar rules hardened behind #settings-sidebar —
 * the legacy settings.css/dashboard-modern.css nav rules (icon hiding,
 * 16px group padding, tight margins) were winning on properties v2 didn't
 * redeclare, which is why icons vanished and the section rhythm cramped.
 * The ID selector out-specifies every legacy class rule.
 *
 * Loaded LAST by includes/dashboard-head.php + includes/shell-head.php.
 * Values mirror SEC redesign.css (.side / .side-section / .side-link).
 */

/* ── Grid + sidebar chrome (desktop; <=768px keeps the drawer) ───────── */
@media (min-width: 769px) {
    /* One sidebar width EVERYWHERE. dashboard.php's .dashboard-app grid
       (dashboard-modern.css, --sb-w 248px + min-height 100vh) and any other
       page-level grid must not diverge from the 240px SEC metric — the
       html-prefixed selectors out-specify them all. */
    .settings-layout,
    html.modern-dashboard .settings-layout,
    html.modern-dashboard .dashboard-app.settings-layout {
        grid-template-columns: 240px 1fr;
        min-height: calc(100vh - 64px);
    }
    #settings-sidebar {
        width: auto !important;   /* !important beats sidebar.js's anti-flash 56px */
        background: var(--bg-1);
        border-right: 1px solid var(--line);
        padding: 24px 16px;
    }
    .settings-main {
        padding: 32px 40px 64px;
        min-width: 0;
    }
}

/* Neutralize the retired collapse mode wherever stale localStorage applies it */
.settings-layout #settings-sidebar.collapsed { width: auto !important; }
#settings-sidebar.collapsed .settings-nav-item-text {
    opacity: 1 !important;
    width: auto !important;
    display: inline !important;
}

/* ── Nav container: sections own the rhythm, no flex-gap noise ───────── */
#settings-sidebar .settings-nav {
    display: block;
    gap: 0;
    padding: 0;
    overflow: visible;
}
#settings-sidebar .settings-nav-group {
    padding: 0;
    margin: 0 0 24px;
    border: 0;
}

/* ── Section labels: SEC h6 ──────────────────────────────────────────── */
#settings-sidebar h6 {
    font: 600 11px/1 var(--sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin: 0 0 10px;
    padding: 0 8px;
}

/* ── Workspace pill (SEC .side top) ──────────────────────────────────── */
#settings-sidebar .side-workspace-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    min-width: 0;
}
#settings-sidebar .side-workspace-mark {
    width: 22px; height: 22px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    flex-shrink: 0;
}
#settings-sidebar .side-workspace-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
#settings-sidebar .side-workspace-plan {
    margin-left: auto;
    font-size: 10px;
    color: var(--ink-3);
    flex-shrink: 0;
}

/* ── Links: the .side-link look ──────────────────────────────────────── */
#settings-sidebar .settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--ink-2);
    font: 400 14px/1.35 var(--sans);
    letter-spacing: normal;
    text-transform: none;
    margin: 0 0 1px;
    width: 100%;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}
#settings-sidebar .settings-nav-item:hover { background: var(--surface-2); color: var(--ink); }
#settings-sidebar .settings-nav-item.active {
    background: var(--surface-2);
    color: var(--ink);
    font-weight: 600;
}
#settings-sidebar .settings-nav-item svg {
    display: block;          /* settings.css hides item icons on desktop */
    width: 16px; height: 16px;
    flex: 0 0 16px;
    color: var(--ink-3);
    opacity: 1;
}
#settings-sidebar .settings-nav-item.active svg { color: var(--accent-1); }
#settings-sidebar .settings-nav-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
/* Optional count pip (SEC .pip) */
#settings-sidebar .settings-nav-item .pip {
    margin-left: auto;
    font: 500 10.5px/1 var(--mono);
    color: var(--ink-3);
}

/* ── Page-header typography: SEC .dash-head h1 ───────────────────────── */
.monitor-page-title,
.ag-header h1 {
    font: 600 28px/1.1 var(--sans);
    letter-spacing: -0.025em;
}

/* ── App header: SEC 64px bar ────────────────────────────────────────── */
.nav-app .nav-inner {
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
}
