﻿/* ── Dark/light theme tokens (added). Same --g3-* family and values as
   the (currently parked) themed graphics-control sheets - identical
   duplicate definitions are harmless and keep the HUD ecosystem on one
   palette when that work lands. RGB-triplet technique: dark renders
   byte-identical; light swaps triplets. Series/status colors in the JS
   config layer are data-plane and unchanged. ── */
.dark-theme {
    --g3-accent-rgb: 56, 189, 248;
    --g3-accent: #38bdf8;
    --g3-accent-bright: #67e8f9;
    --g3-glass-rgb: 2, 8, 20;
    --g3-deep-rgb: 15, 23, 42;
    --g3-ok-rgb: 6, 214, 160;
    --g3-ok: #06d6a0;
    --g3-alarm-rgb: 248, 113, 113;
    --g3-alarm: #f87171;
    --g3-dim-rgb: 148, 163, 184;
    --g3-dim: #94a3b8;
    --g3-fg-rgb: 226, 232, 240;
    --g3-fg: #e2e8f0;
    --g3-fg-mid: #cbd5e1;
    --g3-bright-rgb: 248, 250, 252;
    --g3-warn-rgb: 251, 191, 36;
    --g3-warn: #fbbf24;
    --g3-sel-rgb: 168, 64, 77;
    --g3-sel: #A8404D;
}

.light-theme {
    --g3-accent-rgb: 2, 132, 199;
    --g3-accent: #0284c7;
    --g3-accent-bright: #0369a1;
    --g3-glass-rgb: 255, 255, 255;
    --g3-deep-rgb: 228, 233, 241;
    --g3-ok-rgb: 13, 148, 136;
    --g3-ok: #0d9488;
    --g3-alarm-rgb: 214, 48, 48;
    --g3-alarm: #d63030;
    --g3-dim-rgb: 86, 103, 130;
    --g3-dim: #566782;
    --g3-fg-rgb: 19, 33, 59;
    --g3-fg: #13213B;
    --g3-fg-mid: #2c3e57;
    --g3-bright-rgb: 19, 33, 59;
    --g3-warn-rgb: 180, 83, 9;
    --g3-warn: #b45309;
    --g3-sel-rgb: 168, 64, 77;
    --g3-sel: #A8404D;
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ════════════════════════════════════════════════════════════════════════════
   cards.css  —  HUD Theme  (aligned with twx-panel.css)
   ════════════════════════════════════════════════════════════════════════════
   Sections
     1.  Root container & shared helpers
     2.  Base .card  +  title bar
     3.  Card body  (card2 — MetricCard)
     4.  Expand toggle  (chevron)
     5.  Slide / expand content  (card2 expand section)
     6.  List content  (card3 — NavigationCard / AlarmCard)
        6a.  Search box
        6b.  Sort dropdown
     7.  card3  —  NavigationCard  (right-docked, iconize)
     8.  card6  —  Dual-section collapsible list
        8a.  card6 toolbar
        8b.  card6 sections & headers
        8c.  card6 section body items  (matched to card3 style)
        8d.  card6 controls & iconized state
     9.  card5  —  Accordion card
    10.  Value / status children  (card5 items)
    11.  Utility  (reset button, selected state, legacy)
   ════════════════════════════════════════════════════════════════════════════ */


/* ════════════════════════════════════════════════════════════════════════════
   1.  Root container & shared helpers
   ════════════════════════════════════════════════════════════════════════════ */
.cards {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: flex-end;
    font-family: 'DM Sans', sans-serif;
}

    /* shared border helper — applied to nav-child rows, slide content etc. */
    .cards div.card-border {
        border: 1px solid rgba(var(--g3-accent-rgb), 0.15);
        border-radius: 8px;
    }

    /* shared background helper — used on expand content, text-child, chart-child */
    .cards .card-background {
        background: rgba(var(--g3-glass-rgb), 0.85);
    }


    /* ════════════════════════════════════════════════════════════════════════════
   2.  Base .card  +  title bar
   ════════════════════════════════════════════════════════════════════════════ */
    /* SCOPED under .cards (0,2,0) to beat Bootstrap's card.scss `.card`
   { background-color:#fff; border; border-radius } (0,1,0). Bootstrap
   loads AFTER cards.css, so a bare `.card` here tied on specificity and
   LOST on order -> white card background in dark mode. The card windows'
   inline JSON `background` used to mask this; once that inline style was
   removed (theme moved to CSS) the collision surfaced. Root-cause fix is
   load order, but that's a bundle/cshtml change (Dinesh-only); specificity
   is the CSS-side fix and needs no !important. Cards live in <div class="cards">. */
    .cards .card {
        position: relative;
        top: 150px;
        z-index: 1;
        background: rgba(var(--g3-glass-rgb), 0.85);
        border: 1px solid rgba(var(--g3-accent-rgb), 0.15);
        border-radius: 8px;
        cursor: grab;
        font-family: 'DM Sans', sans-serif;
        font-size: 11px;
        color: rgba(var(--g3-dim-rgb), 0.7);
        box-sizing: border-box;
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

        .cards .card:hover {
            z-index: 9;
            border-color: rgba(var(--g3-accent-rgb), 0.28);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 12px rgba(var(--g3-accent-rgb), 0.1), 0 6px 20px rgba(0, 0, 0, 0.5);
        }

.card label {
    margin: 0;
}

/* ── Title bar — shared by all card types ────────────────────────────────── */
.card .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 26px;
    background: rgba(var(--g3-glass-rgb), 0.75);
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.12);
    border-radius: 8px 8px 0 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

    /* green status dot before title */
    .card .title::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--g3-ok);
        box-shadow: 0 0 6px rgba(var(--g3-ok-rgb), 0.25);
        flex-shrink: 0;
        margin-right: 6px;
    }

    .card .title .label {
        flex: 1;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        height: 100%;
        display: flex;
        align-items: center;
    }

        .card .title .label label {
            margin: 0;
            font-size: 11px;
            font-weight: 700;
            color: rgba(var(--g3-bright-rgb), 0.88);
            letter-spacing: 0.3px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

    /* legacy close control (card2/card4) */
    .card .title .ctrl {
        flex-shrink: 0;
        cursor: pointer;
        color: rgba(var(--g3-dim-rgb), 0.4);
        padding: 0 3px;
        height: 100%;
        display: flex;
        align-items: center;
        transition: color 0.15s;
    }

        .card .title .ctrl:hover {
            color: rgba(var(--g3-alarm-rgb), 0.8);
        }

        .card .title .ctrl i {
            font-size: 11px !important;
        }


/* ════════════════════════════════════════════════════════════════════════════
   3.  Card body  (card2 — MetricCard)
   ════════════════════════════════════════════════════════════════════════════ */
.card .card-body {
    padding: 6px 0 0;
    background: transparent;
    text-align: center;
    color: rgba(var(--g3-dim-rgb), 0.7);
    display: flex;
    flex-flow: column nowrap;
}

    /* big KPI value */
    .card .card-body label {
        margin: 0;
        font-size: 18px;
        font-family: 'JetBrains Mono', monospace;
        font-weight: 700;
        color: var(--g3-ok);
    }


/* ════════════════════════════════════════════════════════════════════════════
   4.  Expand toggle  (chevron — card2 / card4)
   ════════════════════════════════════════════════════════════════════════════ */
.card .icon-container-expand {
    cursor: pointer;
    color: rgba(var(--g3-dim-rgb), 0.45);
    padding: 3px 0;
    text-align: center;
    transition: color 0.15s;
}

    .card .icon-container-expand:hover {
        color: var(--g3-accent);
    }

    .card .icon-container-expand i {
        font-size: 14px !important;
    }


/* ════════════════════════════════════════════════════════════════════════════
   5.  Slide / expand content  (card2 expand section)
   ════════════════════════════════════════════════════════════════════════════ */
.card .slideContent {
    display: none;
    height: 250px;
    position: relative;
    top: 0;
    background: rgba(var(--g3-glass-rgb), 0.6);
    border-top: 1px solid rgba(var(--g3-accent-rgb), 0.08);
    color: rgba(var(--g3-dim-rgb), 0.7);
    text-align: center;
}

    .card .slideContent .child-row {
        width: 100%;
        display: flex;
        line-height: normal;
    }

    /* text-child: large live value */
    .card .slideContent .text-child {
        flex: 1;
    }

        .card .slideContent .text-child span {
            font-size: 36px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            color: var(--g3-ok);
        }

    /* chart-child: Highcharts embed */
    .card .slideContent .chart-child {
        flex: 1;
    }

    /* nav-child inside slide expand */
    .card .slideContent .nav-child {
        flex: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

        .card .slideContent .nav-child label {
            cursor: pointer;
            margin: 0 auto;
            color: rgba(var(--g3-fg-rgb), 0.8);
            font-size: 11px;
        }


/* ════════════════════════════════════════════════════════════════════════════
   6.  List content  (card3 — NavigationCard / AlarmCard)
   ════════════════════════════════════════════════════════════════════════════ */

/* container fills remaining height below title bar */
.card .listContent {
    display: block !important;
    max-height: unset !important;
    height: calc(100% - 26px) !important;
    color: rgba(var(--g3-dim-rgb), 0.7);
    text-align: center;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--g3-accent-rgb), 0.2) transparent;
}

    .card .listContent::-webkit-scrollbar {
        width: 4px;
    }

    .card .listContent::-webkit-scrollbar-track {
        background: transparent;
    }

    .card .listContent::-webkit-scrollbar-thumb {
        background: rgba(var(--g3-accent-rgb), 0.2);
        border-radius: 2px;
    }

        .card .listContent::-webkit-scrollbar-thumb:hover {
            background: rgba(var(--g3-accent-rgb), 0.4);
        }

    /* each item row */
    .card .listContent .child-row {
        width: 100%;
        display: flex;
        line-height: normal;
        margin: 5px 0;
    }

        .card .listContent .child-row:last-child {
            margin-bottom: 5px;
        }

    /* clickable nav item */
    .card .listContent .nav-child {
        background: rgba(var(--g3-deep-rgb), 0.55);
        flex: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        width: 100%;
    }

        .card .listContent .nav-child label {
            cursor: pointer;
            margin: 0 auto;
            width: calc(100% - 10px);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 11px;
            font-weight: 500;
            /* color intentionally omitted — set by JS (applyAlarmColors / updateDataPointTextColor) */
        }

/* base nav-child shape — applies across all card types */
.card .nav-child {
    min-height: 28px;
    border-radius: 5px;
    transition: background 0.15s, border-color 0.15s;
}

    .card .nav-child:hover {
        background: rgba(var(--g3-accent-rgb), 0.08) !important;
        border-color: rgba(var(--g3-accent-rgb), 0.22) !important;
    }

/* ── 6a.  Search box ─────────────────────────────────────────────────────── */
.card .search-box {
    width: 100%;
    padding: 4px 8px 4px 24px;
    background: rgba(var(--g3-deep-rgb), 0.6);
    color: rgba(var(--g3-fg-rgb), 0.85);
    border: 1px solid rgba(var(--g3-accent-rgb), 0.12);
    border-radius: 5px;
    outline: none;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

    .card .search-box:focus {
        border-color: rgba(var(--g3-accent-rgb), 0.35);
    }

    .card .search-box::placeholder {
        color: rgba(var(--g3-dim-rgb), 0.3);
    }

/* ── 6b.  Sort dropdown ──────────────────────────────────────────────────── */
.btnSortCardItems {
    height: 100%;
    margin-right: 4px;
    background: rgba(var(--g3-accent-rgb), 0.08) !important;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.15) !important;
    color: var(--g3-accent) !important;
    border-radius: 4px !important;
    transition: background 0.15s !important;
}

    .btnSortCardItems:hover {
        background: rgba(var(--g3-accent-rgb), 0.15) !important;
    }

/* hide default Bootstrap caret */
.dropdown-toggle::after {
    display: none;
}

.dropdown-menu {
    background: rgba(var(--g3-glass-rgb), 0.97) !important;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.2) !important;
    border-radius: 6px !important;
    box-shadow: 0 0 12px rgba(var(--g3-accent-rgb), 0.08), 0 8px 24px rgba(0, 0, 0, 0.6) !important;
    padding: 4px 0 !important;
    min-width: 150px;
    /* keep Bootstrap from overriding */
    left: unset !important;
    right: 0;
    /* sit above section headers */
    z-index: 9999 !important;
}

/* ── Dropdown items ──────────────────────────────────────────────────────── */
.dropdown-item {
    background: transparent !important;
    color: rgba(var(--g3-dim-rgb), 0.75) !important;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 7px 14px !important;
    border-radius: 0;
    transition: background 0.12s, color 0.12s;
    /* left accent bar — hidden by default */
    border-left: 2px solid transparent;
}

    .dropdown-item:hover,
    .dropdown-item:focus {
        background: rgba(var(--g3-accent-rgb), 0.08) !important;
        color: var(--g3-accent) !important;
        border-left-color: var(--g3-accent);
        outline: none !important;
    }

    .dropdown-item:active {
        background: rgba(var(--g3-accent-rgb), 0.15) !important;
        color: var(--g3-accent) !important;
    }

/* divider between items (optional — add <div class="dropdown-divider"> in HTML) */
.dropdown-divider {
    border-top: 1px solid rgba(var(--g3-accent-rgb), 0.08) !important;
    margin: 3px 0 !important;
}


/* ════════════════════════════════════════════════════════════════════════════
   7.  card3  —  NavigationCard  (right-docked, full-height, iconize support)
   ════════════════════════════════════════════════════════════════════════════ */
.card3 {
    margin-right: 5px;
    left: unset !important;
    right: 0 !important;
    top: 0 !important;
    min-height: unset !important;
    height: 100% !important;
    transition: width 0.25s ease, height 0.25s ease, opacity 0.2s ease;
}

    /* prevent scale on hover (inherited from .card:hover) */
    .card3:hover {
        transform: scale(1);
    }

    .card3 .title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 8px;
    }

        .card3 .title .label {
            flex: 1;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

    /* ── Minimize / close buttons ────────────────────────────────────────────── */
    .card3 .card-controls {
        display: flex;
        gap: 4px;
        flex-shrink: 0;
    }

        .card3 .card-controls button {
            background: transparent;
            border: 1px solid rgba(var(--g3-accent-rgb), 0.12);
            border-radius: 4px;
            color: rgba(var(--g3-dim-rgb), 0.4);
            cursor: pointer;
            padding: 2px 5px;
            line-height: 1;
            font-size: 10px;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }

            .card3 .card-controls button:hover {
                color: var(--g3-fg); /* was #ffffff: hover text over pale accent tint - must flip for light */
                border-color: rgba(var(--g3-accent-rgb), 0.35);
                background: rgba(var(--g3-accent-rgb), 0.08);
            }

        .card3 .card-controls .btn-close-card:hover {
            color: var(--g3-alarm);
            border-color: rgba(var(--g3-alarm-rgb), 0.35);
            background: rgba(var(--g3-alarm-rgb), 0.08);
        }

        /* prevent FontAwesome spin on minus/times icons */
        .card3 .card-controls i {
            animation: none !important;
            -webkit-animation: none !important;
        }

/* ── Iconized square state ───────────────────────────────────────────────── */
.card3--iconized {
    width: 42px !important;
    height: 44px !important;
    min-height: unset !important;
    overflow: visible !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative !important;
    right: 8px;
    background: rgba(var(--g3-glass-rgb), 0.92) !important;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.25) !important;
    box-shadow: 0 0 10px rgba(var(--g3-accent-rgb), 0.12) !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .card3--iconized:hover {
        border-color: rgba(var(--g3-accent-rgb), 0.5) !important;
        box-shadow: 0 0 16px rgba(var(--g3-accent-rgb), 0.25) !important;
    }

    /* hide card content when iconized */
    .card3--iconized .title,
    .card3--iconized .listContent {
        display: none !important;
    }

    /* show icon-label only when iconized */
    .card3--iconized .icon-label {
        display: flex !important;
    }

/* icon-label — hidden by default, shown in iconized state */
.card3 .icon-label {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    color: var(--g3-accent);
    pointer-events: none;
    user-select: none;
}

    /* tint SVG/PNG icons to match cyan accent */
    .card3 .icon-label img {
        filter: invert(1) sepia(1) saturate(2) hue-rotate(160deg) brightness(1.2);
    }

/* tooltip shown on hover when iconized — reads data-card-title attribute */
.card3--iconized::after {
    content: attr(data-card-title);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(var(--g3-glass-rgb), 0.95);
    color: rgba(var(--g3-fg-rgb), 0.9);
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.card3--iconized:hover::after {
    opacity: 1;
}

/* sidebar list indicator for iconized state */
#listCard a.card-iconized-li {
    opacity: 0.6;
    font-style: italic;
}


/* ════════════════════════════════════════════════════════════════════════════
   8.  card6  —  Dual-section collapsible list
   ════════════════════════════════════════════════════════════════════════════ */
.card6 {
    left: unset !important;
    right: 3px !important; /* Dinesh's working value */
    top: 0 !important;
    min-height: unset !important;
    height: 100% !important;
    transition: width 0.25s ease, height 0.25s ease, opacity 0.2s ease;
}

    .card6:hover {
        transform: scale(1);
    }

/* scrollable body below the title bar */
.card6-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100% - 26px);
    cursor: default;
}

/* ── 8a.  Toolbar  (search + sort — sticky at top) ───────────────────────── */
.card6-toolbar {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 6px;
    background: rgba(var(--g3-glass-rgb), 0.96);
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.08);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10; /* above section headers so dropdown renders on top */
}

    /* dropdown menu scoped to toolbar — renders above section content */
    .card6-toolbar .dropdown-menu {
        z-index: 9999;
    }

/* ── 8b.  Sections & headers ─────────────────────────────────────────────── */
.card6-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

    /* divider between sections */
    .card6-section + .card6-section {
        border-top: 1px solid rgba(var(--g3-accent-rgb), 0.08);
    }

/* clickable section header row */
.card6-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer !important;
    user-select: none;
    -webkit-user-select: none;
    background: rgba(var(--g3-glass-rgb), 0.45);
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.06);
    flex-shrink: 0;
    position: relative;
    z-index: 1; /* below toolbar so dropdown menu is not covered */
    transition: background 0.15s;
}

    .card6-section-header:hover {
        background: rgba(var(--g3-accent-rgb), 0.05);
    }

/* status dot — cyan for primary section, grey for secondary */
.card6-section-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(var(--g3-dim-rgb), 0.35);
}

.card6-section:first-of-type .card6-section-dot {
    background: var(--g3-accent);
    box-shadow: 0 0 5px rgba(var(--g3-accent-rgb), 0.5);
}

.card6-section-label {
    flex: 1;
    font-size: 10px;
    font-weight: 700;
    color: rgba(var(--g3-bright-rgb), 0.8);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'DM Sans', sans-serif;
}

/* item count badge */
.card6-section-count {
    font-size: 9px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--g3-accent);
    background: rgba(var(--g3-accent-rgb), 0.1);
    border: 1px solid rgba(var(--g3-accent-rgb), 0.2);
    border-radius: 8px;
    padding: 1px 6px;
    flex-shrink: 0;
    min-width: 20px;
    text-align: center;
    line-height: 1.6;
}

/* collapse chevron — rotates when section is collapsed */
.card6-chevron {
    font-size: 9px;
    color: rgba(var(--g3-dim-rgb), 0.4);
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.card6-chevron--collapsed {
    transform: rotate(-90deg);
}

/* ── 8c.  Section body items  (matched to card3 .listContent style) ──────── */
.card6-section-body {
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--g3-accent-rgb), 0.2) transparent;
}

    .card6-section-body::-webkit-scrollbar {
        width: 4px;
    }

    .card6-section-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .card6-section-body::-webkit-scrollbar-thumb {
        background: rgba(var(--g3-accent-rgb), 0.2);
        border-radius: 2px;
    }

        .card6-section-body::-webkit-scrollbar-thumb:hover {
            background: rgba(var(--g3-accent-rgb), 0.4);
        }

    /* item row — same spacing as card3 list */
    .card6-section-body .child-row {
        width: 100%;
        display: flex;
        line-height: normal;
        margin: 5px 0;
    }

        .card6-section-body .child-row:last-child {
            margin-bottom: 5px;
        }

    /* nav item — identical styling to .card .listContent .nav-child */
    .card6-section-body .nav-child {
        background: rgba(var(--g3-deep-rgb), 0.85);
        flex: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 28px;
        border-radius: 5px;
        border: 1px solid rgba(var(--g3-accent-rgb), 0.15) !important;
        transition: background 0.15s, border-color 0.15s;
    }

        .card6-section-body .nav-child:hover {
            background: rgba(var(--g3-accent-rgb), 0.08) !important;
            border-color: rgba(var(--g3-accent-rgb), 0.22) !important;
        }

        .card6-section-body .nav-child label {
            cursor: pointer;
            margin: 0 auto;
            width: calc(100% - 10px);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 11px;
            font-weight: 500;
            font-family: 'DM Sans', sans-serif;
            /* color set by JS (applyAlarmColors) */
        }

/* ── 8d.  card6 controls & iconized state  (mirrors card3) ──────────────── */
.card6 .card-controls {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

    .card6 .card-controls button {
        background: transparent;
        border: 1px solid rgba(var(--g3-accent-rgb), 0.12);
        border-radius: 4px;
        color: rgba(var(--g3-dim-rgb), 0.4);
        cursor: pointer;
        padding: 2px 5px;
        line-height: 1;
        font-size: 10px;
        transition: color 0.15s, border-color 0.15s, background 0.15s;
    }

        .card6 .card-controls button:hover {
            color: var(--g3-fg); /* was #ffffff: hover text over pale accent tint - must flip for light */
            border-color: rgba(var(--g3-accent-rgb), 0.35);
            background: rgba(var(--g3-accent-rgb), 0.08);
        }

    .card6 .card-controls .btn-close-card:hover {
        color: var(--g3-alarm);
        border-color: rgba(var(--g3-alarm-rgb), 0.35);
        background: rgba(var(--g3-alarm-rgb), 0.08);
    }

    .card6 .card-controls i {
        animation: none !important;
        -webkit-animation: none !important;
    }

.card6--iconized {
    width: 39px !important;
    height: 44px !important;
    min-height: unset !important;
    overflow: visible !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative !important;
    right: 8px;
    background: rgba(var(--g3-glass-rgb), 0.92) !important;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.25) !important;
    box-shadow: 0 0 10px rgba(var(--g3-accent-rgb), 0.12) !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .card6--iconized:hover {
        border-color: rgba(var(--g3-accent-rgb), 0.5) !important;
        box-shadow: 0 0 16px rgba(var(--g3-accent-rgb), 0.25) !important;
    }

    .card6--iconized .title,
    .card6--iconized .card6-body {
        display: none !important;
    }

    .card6--iconized .icon-label {
        display: flex !important;
    }

.card6 .icon-label {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    color: var(--g3-accent);
    pointer-events: none;
    user-select: none;
}

    .card6 .icon-label img {
        filter: invert(1) sepia(1) saturate(2) hue-rotate(160deg) brightness(1.2);
    }

.card6--iconized::after {
    content: attr(data-card-title);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(var(--g3-glass-rgb), 0.95);
    color: rgba(var(--g3-fg-rgb), 0.9);
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.card6--iconized:hover::after {
    opacity: 1;
}


/* ════════════════════════════════════════════════════════════════════════════
   9.  card5  —  Accordion card  (AssetStatusCard)
   ════════════════════════════════════════════════════════════════════════════ */
.accordion_card.card5 {
    position: relative;
    color: rgba(var(--g3-fg-rgb), 0.85);
    max-width: 100%;
    width: 170px;
    top: 0;
    margin-right: 5px;
}

/* nested .card inside accordion must not inherit top:150px */
.accordion_card .accordion .card {
    position: relative;
    top: 0;
}

.accordion_card_title {
    text-align: center;
    padding: 5px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(var(--g3-bright-rgb), 0.88);
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.08);
}

/* accordion group header button */
.accordion-card-header button.accordion_title {
    background: rgba(var(--g3-deep-rgb), 0.7);
    color: rgba(var(--g3-fg-rgb), 0.85);
    box-shadow: none;
    border: none;
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.08);
    width: 100%;
    padding: 6px 10px 6px 20px;
    outline: none;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    position: relative;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.15s, color 0.15s;
}

    .accordion-card-header button.accordion_title:hover {
        background: rgba(var(--g3-accent-rgb), 0.06);
        color: var(--g3-fg); /* was #ffffff: hover text over pale accent tint - must flip for light */
    }

/* remove bottom border on last group */
.cardWrapper:last-child .accordion-card-header button.accordion_title {
    border-bottom: none;
}

/* chevron pseudo-element before group label */
.accordion-card-header button.accordion_title::before {
    content: '';
    position: absolute;
    top: 9px;
    left: 6px;
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid rgba(var(--g3-accent-rgb), 0.6);
    border-top: 1.5px solid rgba(var(--g3-accent-rgb), 0.6);
    transform: rotate(135deg);
}

/* card body paragraph rows inside accordion */
.accordion_card .card-body p {
    margin-bottom: 1px;
    background: rgba(var(--g3-deep-rgb), 0.6);
    padding: 4px 12px;
    position: relative;
    text-align: left;
    font-size: 11px;
    color: rgba(var(--g3-dim-rgb), 0.7);
    border-bottom: 1px solid rgba(var(--g3-accent-rgb), 0.05);
}

    /* status indicator boxes — green default, red override */
    .accordion_card .card-body p .greenBox,
    .accordion_card .card-body p .redBox {
        width: 14px;
        height: 14px;
        border-radius: 3px;
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        background: var(--g3-ok);
        box-shadow: 0 0 6px rgba(var(--g3-ok-rgb), 0.38);
    }

    .accordion_card .card-body p .redBox {
        background: var(--g3-alarm);
        box-shadow: 0 0 6px rgba(var(--g3-alarm-rgb), 0.38);
    }


/* ════════════════════════════════════════════════════════════════════════════
   10.  Value / status children  (card5 group items)
   ════════════════════════════════════════════════════════════════════════════ */

/* value-child: label + live numeric span */
.valueChild {
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    color: rgba(var(--g3-dim-rgb), 0.65);
    margin-left: 10px;
    margin-bottom: 3px;
}

    .valueChild:first-of-type {
        margin-top: 8px;
    }

    .valueChild:last-of-type {
        margin-bottom: 12px;
    }

    .valueChild span {
        font-family: 'JetBrains Mono', monospace;
        font-size: 12px;
        font-weight: 700;
        color: var(--g3-ok);
        margin-left: 8px;
    }


/* ════════════════════════════════════════════════════════════════════════════
   11.  Utility
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Reset button ────────────────────────────────────────────────────────── */
#btnResetCards {
    width: 100%;
    background: rgba(var(--g3-deep-rgb), 0.7);
    color: rgba(var(--g3-dim-rgb), 0.6);
    outline: none;
    border: 1px solid rgba(var(--g3-accent-rgb), 0.12);
    border-radius: 0 0 6px 6px;
    margin: 2px 0 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    padding: 5px 0;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.15s, color 0.15s;
}

    #btnResetCards:hover {
        background: rgba(var(--g3-accent-rgb), 0.08);
        color: var(--g3-accent);
        border-color: rgba(var(--g3-accent-rgb), 0.3);
    }

/* ── Selected / active state  (#listCard sidebar links) ─────────────────── */
.selected-li-a {
    /* color: var(--g3-ok) !important;*/
}

/* ── Hidden utility elements ─────────────────────────────────────────────── */
#aaa,
#bbb-bbb {
    display: none;
}

/* ── card1  (legacy — kept for reference) ────────────────────────────────── */
#card1 {
    height: 100px;
    width: 100px;
    display: none;
    left: 1600px;
    top: 50px;
}

    #card1 .card-body table {
        width: 100%;
        text-align: center;
        color: rgba(var(--g3-dim-rgb), 0.7);
    }


/* ── LIGHT-THEME OPACITY FLOOR (compositing lesson, 4th appearance):
   these card roots float over the 3D canvas, which stays DARK in both
   themes (Babylon scene color is config, not theme). Translucent WHITE
   glass over a dark scene composites to murky grey, so light mode
   lifts the roots to near-opaque. Dark keeps the original glass. ── */
.light-theme .cards .card-background,
.light-theme .card,
.light-theme .card .title,
.light-theme .card .slideContent {
    background: rgba(var(--g3-glass-rgb), 0.96);
}

    /* ── LIGHT ARMOR: config-driven WHITE text (Flr_01-cards.json carries
   4,022 default rangeMapping slots of color:#ffffff which the JS writes
   as INLINE styles - readable on dark, invisible on light). These
   selectors match ONLY white inline colors, in their four real-world
   serializations, so semantic status colors (alarm reds / ambers from
   populated range mappings) pass through untouched. CSS !important
   beats non-important inline styles. Self-correcting: if the config
   defaults are ever fixed, nothing matches. ── */
    .light-theme .cards [style*="color:#ffffff" i],
    .light-theme .cards [style*="color: #ffffff" i],
    .light-theme .cards [style*="color:rgb(255, 255, 255)"],
    .light-theme .cards [style*="color: rgb(255, 255, 255)"],
    .light-theme .card [style*="color:#ffffff" i],
    .light-theme .card [style*="color: #ffffff" i],
    .light-theme .card [style*="color:rgb(255, 255, 255)"],
    .light-theme .card [style*="color: rgb(255, 255, 255)"] {
        color: var(--g3-fg) !important;
    }

    /* ── LIGHT READABILITY: card body text to solid fg, matching the list
   items Dinesh flagged as the good reference. Two mechanisms:
   1) CSS-owned rules ride dark-tuned alphas (.65-.75 dim) - solid
      overrides, no !important needed (later + .light-theme wins).
   2) JS templates write INLINE colors: dim rgba(148,163,184,.6) on
      labels, sky #38bdf8 on headers/values - matched by value traps
      with !important. Semantic warn (#fbbf24) / alarm (#f87171)
      inline colors are deliberately NOT trapped. ── */
    .light-theme .card,
    .light-theme .card .card-body,
    .light-theme .card .slideContent,
    .light-theme .card .listContent,
    .light-theme .valueChild,
    .light-theme .accordion_card .card-body p,
    .light-theme #card1 .card-body table {
        color: var(--g3-dim); /* Dinesh: match the floor-list label tone
        (medium slate), solid fg read too heavy */
    }

        .light-theme .card [style*="color:rgba(148,163,184" i],
        .light-theme .card [style*="color: rgba(148, 163, 184"] {
            color: var(--g3-dim) !important; /* faint dim labels -> floor-label tone */
        }

        .light-theme .card [style*="color:#38bdf8" i],
        .light-theme .card [style*="color: #38bdf8" i] {
            color: var(--g3-accent) !important; /* dark-sky inline -> light accent
        (sky-700), keeping accent semantics but readable on white */
        }
