/* Dashboard quy trình của các phân hệ (Sis*Cpn.razor, Sis*erp.razor): phần tử gốc mang lớp .sis-dash.
   Mỗi trang đặt tên lớp riêng (cdsh-, pf-, tx-, sales-, cash-, crm-...), nên ở đây khớp theo VAI TRÒ của tên lớp
   (-card, -item, node-icon, -label, -line, -dot...) và tô bằng biến --dash-*.
   Bảng màu --dash-* khai trong sis-dark.css / sis-blue.css. Theme Sáng không áp gì: giữ thiết kế gốc của trang.
   Trang dashboard mới: gắn "sis-dash" vào phần tử gốc (cả bản desktop lẫn mobile) và đặt tên lớp theo các vai trò dưới đây. */

/* ── Nền trang, thẻ, khối ──────────────────────────────────────── */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash,
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-page"], [class$="-desktop"], [class$="-mobile"]) {
    background-color: var(--dash-page) !important;
    color: var(--dash-text);
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.card, [class$="-card"], [class*="-card "], [class*="mobile-block"]:not([class*="-header"]), [class*="mobile-content"], [class$="-m-block"], [class$="-m-body"], [class$="-stage"], [class$="-pop"], [class$="-mod"], [class$="-stat"], [class*="-stat "], [class$="-flow"], [class$="-side"], [class$="-lane"], .center-col) {
    background: var(--dash-surface) !important;
    border-color: var(--dash-line-soft) !important;
    box-shadow: 0 0 0 1px var(--dash-line-soft), var(--dash-shadow) !important;
    color: var(--dash-text);
}

/* Chữ: nhãn nút, tiêu đề, mô tả (đặt trước khối tiêu đề thẻ để tiêu đề đè được) */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class*="label"], [class$="-title"], [class$="-text"], [class$="-name"], [class$="-txt"], [class$="-txt"] b, .flow-node, .node-text, .item-text, .node-title, .orbit-item span, .center-circle span, [class*="-card"] h4, p) {
    color: var(--dash-text) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-sub"], [class$="-desc"], [class$="-note"], [class$="-hint"], [class$="-no"], [class$="-num"], [class$="-tag"]) {
    color: var(--dash-muted) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.card-header, [class*="card-header"], [class$="-side-title"], [class$="-section-title"]) {
    background: transparent !important;
    border-bottom-color: var(--dash-line-soft) !important;
}

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.card-header, [class*="card-header"], [class$="-card-head"], [class$="-head"]:not([class$="-m-head"]), [class$="-st-top"]) :is(h2, h3, i),
    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-side-title"], [class$="-section-title"], [class$="-phase-title"], [class$="-card"] > h3) {
        color: var(--dash-title) !important;
    }

/* ── Mục bấm được: chức năng, danh mục, báo cáo, ô mobile ─────── */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-item"], [class*="-item "]):not(.orbit-item, .flow-item),
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-tile"], [class*="-tile "], [class$="-m-item"], [class$="-loop"], [class*="tab-btn"], [class$="-refresh"], [class$="-handoff"], .crm-node, .mobile-center-node, [class$="-mobile-center"], [class$="-m-hub"], [class$="-gate"], [class$="-pill"], [class*="-pill "]) {
    background: var(--dash-item-bg) !important;
    border-color: var(--dash-item-line) !important;
    box-shadow: none !important;
    color: var(--dash-item-text) !important;
}

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-item"], [class*="-item "]):not(.orbit-item, .flow-item):hover,
    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-tile"], [class*="-tile "], [class$="-m-item"], [class$="-loop"], [class*="tab-btn"], [class$="-refresh"], .crm-node, .mobile-center-node, [class$="-mobile-center"], [class$="-m-hub"]):hover,
    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class*="tab-btn"].active {
        background: var(--dash-item-hover-bg) !important;
        border-color: var(--dash-accent) !important;
    }

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-item"], [class*="-item "]):not(.orbit-item, .flow-item) i,
    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-tile"], [class*="-tile "], [class$="-m-item"], [class$="-loop"], [class$="-refresh"], [class$="-handoff"]) > i {
        color: var(--dash-item-icon) !important;
    }

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-item"], [class*="-item "]):not(.orbit-item, .flow-item) :is(span, b, strong) {
        color: var(--dash-item-text) !important;
    }

/* Trạng thái giữ ý nghĩa màu (đạt / cảnh báo / lỗi) */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.ok, .is-ok) { color: var(--dash-ok) !important; }
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.warn, .is-warning, .is-warning b, .is-alert, .is-alert b) { color: var(--dash-warn) !important; }
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.bad, .is-danger, .is-danger b) { color: var(--dash-bad) !important; }

/* ── Sơ đồ quy trình: nút tròn ─────────────────────────────────── */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class*="node-icon"], [class*="center-icon"], [class*="tile-icon"], [class*="hub-icon"], .icon-circle, .item-icon-wrap, .orbit-item, .pf-node, .sphere, .sphere-sm, [class$="-sphere"], [class$="-sphere-sm"], .fn-icon, [class$="-ico"], .admin-badge) {
    background: var(--dash-node-bg) !important;
    border-color: var(--dash-node-line) !important;
    outline-color: var(--dash-node-outline) !important;
    box-shadow: var(--dash-node-shadow) !important;
}

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class*="-node"], .flow-item, .orbit-item, .pf-node, [class*="-sphere"]):hover :is([class*="node-icon"], .icon-circle, [class$="-sphere"]),
    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.orbit-item, .pf-node):hover {
        box-shadow: var(--dash-node-shadow-hover) !important;
    }

/* Nút trung tâm / nút bắt đầu của quy trình */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.center-circle, .main-node .icon-circle.big, .center-node .icon-circle.big, .center-node .sphere, .fn-center-icon, .crm-node-erp .crm-node-icon, .cash-center .cash-node-icon, .sales-center .sales-node-icon, .sales-start .sales-node-icon, .tx-center .tx-node-icon, .cdsh-start .cdsh-node-icon, .stock-hub .stock-node-icon, .qcerp-hub .qcerp-node-icon, .pf-start) {
    background: var(--dash-center-bg) !important;
    border-color: transparent !important;
    outline-color: var(--dash-node-outline) !important;
    box-shadow: var(--dash-center-shadow) !important;
}

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.center-circle, .main-node .icon-circle.big, .center-node .icon-circle.big, .center-node .sphere, .fn-center-icon, .crm-node-erp .crm-node-icon, .cash-center .cash-node-icon, .sales-center .sales-node-icon, .sales-start .sales-node-icon, .tx-center .tx-node-icon, .cdsh-start .cdsh-node-icon, .stock-hub .stock-node-icon, .qcerp-hub .qcerp-node-icon, .pf-start) i {
        color: var(--dash-center-icon) !important;
        filter: none !important;
    }

/* Số thứ tự / số lượng gắn trên nút: giữ màu, viền theo nền thẻ */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class*="-sphere"], .sphere) :is(.stt, .cnt),
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class$="-phase-title"] .no {
    border-color: var(--dash-surface) !important;
}

/* ── Đường nối, ngoặc, chấm, mũi tên ───────────────────────────── */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.flow-link, .hub-line, .hub-connector-h, [class*="-line-"], [class$="-line"], [class*="-line "], [class$="-arr"]) {
    background: var(--dash-connector) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class*="bracket"] {
    border-color: var(--dash-connector) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is([class$="-dot"], [class*="-dot "], [class*="-dot-"]) {
    background: var(--dash-dot) !important;
    border-color: var(--dash-surface) !important;
    box-shadow: 0 0 0 1px var(--dash-connector) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.left-col, .right-col, .center-col, .center-hub, .flowchart-container, .center-node, .left-col .flow-item, .right-col .flow-item)::before,
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.center-col, .center-hub, .flowchart-container, .center-node, .left-col .flow-item)::after,
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.top-node, .bottom-node, .center-node) .icon-circle.big::before,
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class$="-step"]:not(:last-child)::after {
    background: var(--dash-connector) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash :is(.top-node, .bottom-node, .center-node) .icon-circle.big::after {
    background: var(--dash-dot) !important;
    box-shadow: 0 0 0 2px var(--dash-surface) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class$="-step"]:not(:last-child)::before {
    border-left-color: var(--dash-connector) !important;
}

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .sis-dash [class$="-down"] {
    color: var(--dash-connector) !important;
}

/* ── Menu chuột phải trên nút quy trình (style nội tuyến nền trắng) ── */
html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .context-menu {
    background: var(--dash-surface) !important;
    color: var(--dash-text);
    box-shadow: 0 0 0 1px var(--dash-line-soft), 0 8px 24px rgba(0, 0, 0, .25) !important;
}

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .context-menu h6 {
        color: var(--dash-title) !important;
    }

    html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .context-menu .btn-light {
        background: var(--dash-item-bg);
        border-color: var(--dash-item-line);
        color: var(--dash-item-text);
    }

        html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) .context-menu .btn-light:hover {
            background: var(--dash-item-hover-bg);
            border-color: var(--dash-accent);
        }

html:is([data-sis-theme="dark"], [data-sis-theme="blue"]) :is(.context-menu-cancel, [class$="-menu-cancel"]) {
    background: var(--dash-item-bg) !important;
    border: 1px solid var(--dash-item-line) !important;
    box-shadow: none !important;
    color: var(--dash-accent) !important;
}
