/* ============================================================
   BuoyDeck — LenelS2 Synergy design system
   ============================================================ */

:root {
    --ink: #0B2239;
    --ink-2: #33485C;
    --muted: #6B7C8C;
    --line: #E2E8EF;
    --line-soft: #EDF1F5;
    --bg: #F2F5F8;
    --card: #FFFFFF;
    --blue: #1558A8;
    --blue-2: #2C7BE5;
    --blue-tint: #EAF1FB;
    --red: #EE3124;
    --green: #138A5E;
    --amber: #B5791A;
    --purple: #6B4FA8;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(11, 34, 57, .06), 0 8px 24px rgba(11, 34, 57, .05);
}

/* ---------- reset / base ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-optical-sizing: auto;
}

a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, code, .num {
    font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
    background: var(--ink);
    color: #C4D2E0;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 14px;
}
.brand__logo { width: 30px; height: 30px; flex: none; }
.brand__name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand__sub { color: #7E93A8; font-size: 11px; letter-spacing: .02em; }

.nav-group { margin-bottom: 16px; }
.nav-group__label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #5E7488;
    padding: 0 8px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #C4D2E0;
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--blue); color: #fff; }
.nav-item__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }

.sidebar__footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 12px;
    color: #7E93A8;
}
.sidebar__footer a { color: #A9BCD0; }

/* ---------- main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 26px;
}
.topbar__crumb { color: var(--muted); font-size: 13px; }
.topbar__crumb strong { color: var(--ink); font-weight: 600; }
.topbar__spacer { flex: 1; }
.topbar__search-form { display: flex; margin: 0; }
.topbar__search {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    width: 240px;
    background: var(--bg);
    color: var(--ink);
    font-family: inherit;
}
.topbar__search:focus {
    outline: none;
    border-color: var(--blue-2);
    background: var(--card);
    box-shadow: 0 0 0 3px var(--blue-tint);
}
.proto-pill {
    background: var(--amber);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: .02em;
}

.content { padding: 26px; max-width: 1240px; width: 100%; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: 11px;
    font-weight: 600;
    color: var(--blue-2);
    margin-bottom: 6px;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; max-width: 720px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.card__title { font-size: 14px; font-weight: 600; margin: 0 0 14px; }
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2-1 { grid-template-columns: 1.6fr 1fr; }

/* ---------- stat card ---------- */
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat-label {
    font-size: 12px; color: var(--muted); font-weight: 500;
    margin-bottom: 8px;
}
.stat-value {
    font-family: 'DM Mono', monospace;
    font-size: 28px; font-weight: 500; color: var(--ink);
    line-height: 1; letter-spacing: -.02em;
}
.stat-delta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-delta.up { color: var(--green); }

/* ============================================================
   STATUS PILLS
   ============================================================ */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    color: #fff;
    background: var(--muted);
}
.pill--active, .pill--qualified { background: var(--blue-2); }
.pill--won { background: var(--green); }
.pill--design { background: var(--purple); }
.pill--trr { background: var(--amber); }
.pill--quote { background: var(--muted); }
.pill--stalled { background: var(--muted); }
.pill--lost { background: var(--red); }
.pill--target { background: var(--line); color: var(--muted); }
/* Abandoned = no-decision / dropped, NOT a competitive loss (kept visually
   distinct from lost, consistent with the Sufficiency dashboard's buckets). */
.pill--abandoned { background: var(--ink-2); }
.pill--pending { background: var(--amber); }

/* ============================================================
   SALESFORCE OPP # — the key tying a project to the SFDC / sufficiency book
   ============================================================ */
/* List cell */
.opp-num {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink);
    background: var(--blue-tint);
    border: 1px solid #D3E2F7;
    border-radius: 5px;
    padding: 2px 7px;
    white-space: nowrap;
}
/* Detail banner */
.opp-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--blue-tint);
    border: 1px solid #D3E2F7;
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 0 16px;
}
.opp-banner__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    color: var(--blue);
}
.opp-banner__value {
    font-size: 18px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -.01em;
}
.opp-banner__value--empty { color: var(--muted); font-style: italic; font-size: 14px; }
/* Form field */
.field--key label { color: var(--blue); }
.badge--key {
    background: var(--blue);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 9.5px;
}
input.input-key {
    font-family: 'DM Mono', monospace;
    font-size: 15px;
    border-color: var(--blue-2);
    background: var(--blue-tint);
    max-width: 260px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 600;
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--line);
}
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.table .num { text-align: right; font-size: 13px; }
.t-strong { font-weight: 600; color: var(--ink); }
.t-sub { color: var(--muted); font-size: 12px; }

.var-cell { color: var(--red); font-family: 'DM Mono', monospace; font-weight: 500; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #124d94; color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--line); }
.btn-danger:hover { background: #fdecea; border-color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, .select, .textarea,
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue-2);
    box-shadow: 0 0 0 3px var(--blue-tint);
}
textarea { resize: vertical; min-height: 90px; }
.help-text { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* segmented control */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented label { padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); }
.segmented label:last-child { border-right: none; }
.segmented input { display: none; }
.segmented input:checked + span { color: var(--blue); font-weight: 600; }
.segmented label:has(input:checked) { background: var(--blue-tint); }
/* segmented toggle-button control (analytics region/quarter/scenario/metric) */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { display: inline-block; padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: #fff; border: none; border-right: 1px solid var(--line); text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.6; }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.seg-btn.is-active { background: var(--blue); color: #fff; font-weight: 600; }
.seg-btn.is-active:hover { background: #124d94; color: #fff; }
.seg-btn.is-disabled { color: var(--muted); background: var(--bg); cursor: not-allowed; opacity: .6; }
.seg-btn.is-disabled:hover { background: var(--bg); color: var(--muted); }
/* analytics tab nav */
.tab-link { padding: 8px 13px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); border-radius: 8px 8px 0 0; text-decoration: none; border-bottom: 2px solid transparent; }
.tab-link:hover { background: var(--bg); text-decoration: none; }
.tab-link.tab-active { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); }

/* ============================================================
   AVATARS
   ============================================================ */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    color: #fff; font-size: 12px; font-weight: 600; flex: none;
    font-family: 'DM Sans', sans-serif;
}
.avatar--lg { width: 56px; height: 56px; font-size: 20px; }
/* supporters (co-attribution) render smaller + ringed, secondary to the lead */
.avatar--support { width: 24px; height: 24px; font-size: 10px; opacity: .85; box-shadow: 0 0 0 2px #fff; }
.avatar-row { display: flex; align-items: center; gap: 9px; }

/* ============================================================
   REGION BAR CHART
   ============================================================ */
.region-bar { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 12px; margin-bottom: 12px; }
.region-bar__label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.region-bar__track { background: var(--line-soft); border-radius: 6px; height: 10px; overflow: hidden; }
.region-bar__fill { background: linear-gradient(90deg, var(--blue), var(--blue-2)); height: 100%; border-radius: 6px; }
.region-bar__value { font-family: 'DM Mono', monospace; font-size: 12.5px; color: var(--ink); }

/* ============================================================
   MISC LAYOUT HELPERS
   ============================================================ */
.stack > * + * { margin-top: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    background: var(--blue-tint); color: var(--blue); font-size: 11px; font-weight: 600;
}
.badge--admin { background: #fbe9e7; color: var(--red); }
.badge--camera { background: #e3f3ec; color: var(--green); }
.badge--integration { background: #ece7f6; color: var(--purple); }
/* co-attribution: lead = primary (filled), supporter = secondary (muted) */
.badge--lead { background: var(--blue); color: #fff; }
.badge--support { background: #eef2f6; color: var(--ink-2); }
.tag-row-cameras { margin-top: 4px; }
.tag-rows { display: flex; flex-direction: column; gap: 8px; }
.tag-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag-row__label {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); min-width: 72px;
}
.count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
}
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.note {
    background: var(--blue-tint);
    border: 1px solid #D3E2F7;
    color: var(--ink-2);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}
.note--warn { background: #fdf4e6; border-color: #f0dcb6; color: #7a561a; }

.project-mini { padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.project-mini:last-child { border-bottom: none; }

.section-gap { margin-top: 22px; }
.hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* ============================================================
   STUDIO
   ============================================================ */
.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.dropzone {
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    background: var(--bg);
}
.output-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; color: var(--muted); padding: 60px 20px; min-height: 340px;
}
.output-empty svg { opacity: .35; margin-bottom: 14px; }
.subtotal-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0 2px; margin-top: 8px; border-top: 2px solid var(--line);
    font-weight: 600;
}
.subtotal-row .num { font-family: 'DM Mono', monospace; font-size: 16px; }

.doc-preview { border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: #fff; }
.doc-preview h3 { margin: 0 0 4px; font-size: 16px; }
.draft-stamp {
    display: inline-block; border: 1px solid var(--amber); color: var(--amber);
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1200px 600px at 70% -10%, rgba(44, 123, 229, .18), transparent 60%),
        linear-gradient(160deg, #0B2239 0%, #0E2E4C 55%, #103a61 100%);
}
.login-card {
    width: 100%; max-width: 400px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    padding: 32px 30px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.login-chrome {
    display: flex; align-items: center; gap: 8px;
    background: rgba(0, 0, 0, .2);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px; color: #A9BCD0;
    margin-bottom: 24px;
    font-family: 'DM Mono', monospace;
}
.login-chrome .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .logo { width: 42px; height: 42px; margin: 0 auto 12px; display: block; }
.login-head h1 { color: #fff; font-size: 20px; margin: 0 0 3px; font-weight: 700; }
.login-head p { color: #8FA6BD; font-size: 12.5px; margin: 0; }
.login-card label { color: #C4D2E0; font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 5px; }
.login-card input {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    margin-bottom: 14px;
}
.login-card input::placeholder { color: #6E859C; }
.login-card input:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(44, 123, 229, .25); }
.login-error {
    background: rgba(238, 49, 36, .15);
    border: 1px solid rgba(238, 49, 36, .4);
    color: #ffb4ad;
    border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.login-foot { text-align: center; color: #7E93A8; font-size: 11.5px; margin-top: 18px; }

/* ============================================================
   TOAST + HTMX INDICATOR
   ============================================================ */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--ink); color: #fff;
    padding: 12px 16px; border-radius: 10px;
    font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    min-width: 220px;
}

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--blue-2);
    animation: spin .7s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar__footer { margin: 0 0 0 auto; padding-top: 0; border: none; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3, .grid-2, .grid-2-1, .studio-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   FLASH MESSAGES (django.contrib.messages)
   ============================================================ */
.flash-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow);
}
.flash--success { border-left-color: var(--green); }
.flash--error { border-left-color: var(--red); }
.flash--warning { border-left-color: var(--amber); }

/* ============================================================
   DANGER ZONE (destructive actions — admin only)
   ============================================================ */
.danger-zone { border-color: #f4c7c3; background: #fffaf9; }
.danger-zone__title { color: var(--red); }
.danger-zone__warn { margin: 0 0 10px; color: var(--ink); font-weight: 500; }
.danger-zone__list { margin: 0 0 14px; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.danger-zone__list li { margin-bottom: 2px; }
.danger-zone__error {
    margin: 0 0 12px; padding: 8px 12px;
    border-radius: 8px; background: #fdecea; color: var(--red);
    font-size: 13px;
}
.btn-danger:disabled, .btn-danger[disabled] {
    opacity: .5; cursor: not-allowed; color: var(--muted); border-color: var(--line);
}
.btn-danger:disabled:hover, .btn-danger[disabled]:hover { background: #fff; border-color: var(--line); }

/* ============================================================
   PROJECT FORM — TAG MULTI-SELECTS (platforms / cameras / integrations)
   Layout only. The checkbox lists flow into responsive columns instead of one
   long vertical list. `columns: 3 190px` = at most 3 columns, each at least
   190px wide, so the browser drops to 2 and then 1 column as the form narrows.
   Structure is Django's: #id_platforms > group div > (group label + option div),
   and a flat #id_cameras / #id_integrations > option div.
   ============================================================ */
#id_platforms > div > div,
#id_cameras,
#id_integrations {
    columns: 3 190px;
    column-gap: 24px;
}

/* An option must never be split down the middle by a column break. */
#id_platforms > div > div > div,
#id_cameras > div,
#id_integrations > div {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

/* Access / VMS subheaders stay full width above their columns. */
#id_platforms > div { margin-bottom: 12px; }
#id_platforms > div > label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 6px;
}

/* Option rows. */
#id_platforms > div > div > div > label,
#id_cameras > div > label,
#id_integrations > div > label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--ink);
    cursor: pointer;
}
#id_platforms input[type=checkbox],
#id_cameras input[type=checkbox],
#id_integrations input[type=checkbox] { accent-color: var(--blue); margin: 0; }

@media (max-width: 640px) {
    #id_platforms > div > div,
    #id_cameras,
    #id_integrations { column-count: 1; }
}

/* ============================================================
   COLLAPSIBLE SIDEBAR (G1) — additive, layout only
   State lives in the `bd_sidebar` cookie and is rendered as
   `.app.sidebar-collapsed` server-side, so it survives navigation
   (including hx-boost body swaps) with no flash.
   ============================================================ */
.app { transition: grid-template-columns .22s ease; }

.nav-item__icon {
    width: 20px; height: 20px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.nav-item__icon svg { width: 18px; height: 18px; }
.nav-item__label { white-space: nowrap; overflow: hidden; }

.sidebar__bottom { margin-top: auto; }

/* The collapse toggle lives in the brand row at the TOP of the sidebar (next to
   Synergy / by Honeywell BS) — the conventional, discoverable spot. It stays in
   that same spot when collapsed, where it is the re-expand control. */
.sidebar__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    flex: none; margin-left: auto;
    width: 28px; height: 28px;
    background: rgba(255, 255, 255, .04); color: #C4D2E0;
    border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px;
    padding: 0; cursor: pointer; font: inherit;
}
.sidebar__toggle:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar__toggle .nav-item__icon { width: 18px; height: 18px; }
.sidebar__toggle .nav-item__icon svg { width: 16px; height: 16px; }
.sidebar__toggle-chevron { transition: transform .22s ease; }

.sidebar__user { margin-bottom: 8px; }
.sidebar__signout { display: flex; align-items: center; gap: 10px; color: #A9BCD0; }
.sidebar__signout:hover { color: #fff; text-decoration: none; }

/* Collapsed state — desktop only. On narrow screens (<=980px) the sidebar
   already reflows into a stacked top row, so collapse does not apply there. */
@media (min-width: 981px) {
    .app.sidebar-collapsed { grid-template-columns: 64px 1fr; }
    .sidebar-collapsed .sidebar { padding: 18px 8px; }
    /* Collapsed: the logo and the toggle stack, both centred in the 64px rail,
       so the toggle is still at the top and still visible as the way back out. */
    .sidebar-collapsed .brand {
        flex-direction: column; justify-content: center; gap: 8px;
        padding: 4px 0 14px;
    }
    .sidebar-collapsed .brand__text,
    .sidebar-collapsed .nav-group__label,
    .sidebar-collapsed .nav-item__label,
    .sidebar-collapsed .sidebar__user { display: none; }
    .sidebar-collapsed .nav-item { justify-content: center; padding: 8px 0; gap: 0; }
    .sidebar-collapsed .sidebar__toggle { margin-left: 0; }
    .sidebar-collapsed .sidebar__toggle-chevron { transform: rotate(180deg); }
    .sidebar-collapsed .sidebar__signout { justify-content: center; gap: 0; }
}
@media (max-width: 980px) {
    .sidebar__toggle { display: none; }        /* collapse control is desktop-only */
    .sidebar__bottom { margin: 0 0 0 auto; }   /* sit at the right of the mobile row, like the old footer */
}
