/* Tax3S — animated flow demos (Zentic-style) for app panels */
/* Scale fluid: layout --tx-flow-*; chữ theo --tx-fs-base (tax3s-tokens.css) */

.sl-app-panel-flow {
    flex: 1 1 clamp(9.5rem, 30%, 18.5rem);
    width: auto;
    min-width: 0;
    max-width: clamp(10.5rem, 26vw, 18.5rem);
}

/* Banner tím (launcher): chiều cao đủ để đọc sơ đồ (ưu tiên rõ nội dung) */
.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow {
    flex: 1 1 clamp(10.5rem, 34%, 21rem);
    max-width: min(21rem, 40%);
    width: 100%;
    height: clamp(11.5rem, 24vw, 13.25rem);
    min-height: clamp(11.5rem, 24vw, 13.25rem);
    max-height: none;
    align-self: center;
    display: grid;
    grid-template-rows: auto minmax(7.25rem, 1fr) auto;
    grid-template-columns: 1fr;
    overflow: hidden;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow.tx-flow-hub--dense {
    height: clamp(15.5rem, 30vw, 18rem);
    min-height: clamp(15.5rem, 30vw, 18rem);
    grid-template-rows: auto minmax(11.5rem, 1fr) auto;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-demo__prompt {
    display: none;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-demo__head {
    grid-row: 1;
    padding: 0.28em 0.42em;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-hub__stage {
    grid-row: 2;
    position: relative;
    min-height: 7.25rem;
    width: 100%;
    aspect-ratio: unset;
    margin: 0;
    padding: 0.2em 0.15em;
    overflow: hidden;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow.tx-flow-hub--dense .tx-flow-hub__stage {
    min-height: 11.5rem;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-demo__metrics {
    grid-row: 3;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node {
    max-width: min(5.8em, 46cqi);
    padding: 0.28em 0.35em;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node--hub {
    max-width: min(4.8em, 38cqi);
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node strong {
    font-size: 0.54em;
    line-height: 1.28;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node small {
    font-size: 0.46em;
}

.sl-app-panel-head .tx-flow-demo.sl-app-panel-flow.tx-flow-hub--dense .tx-flow-hub__node strong {
    font-size: 0.5em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node {
    max-width: min(4.35em, 34cqi);
    padding: 0.2em 0.28em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node--hub {
    max-width: min(3.75em, 30cqi);
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node strong {
    font-size: 0.48em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node small {
    font-size: 0.4em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-hub__node--hub strong {
    font-size: 0.52em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-demo__metric {
    padding: 0.28em 0.25em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-demo__metric strong {
    font-size: 0.62em;
}

.tx-flow-demo.sl-app-panel-flow .tx-flow-demo__canvas {
    min-height: min(var(--tx-flow-canvas-min-h), 28cqi);
}

.tx-flow-hub__scale {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: scale(var(--tx-flow-stage-scale, 1));
    transform-origin: center center;
    pointer-events: none;
}

.tx-flow-demo {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #fff;
    border-radius: var(--tx-flow-radius, 12px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 var(--tx-flow-shadow-y, 8px) calc(var(--tx-flow-shadow-y, 8px) * 3.5) rgba(0, 0, 0, 0.14);
    overflow: hidden;
    line-height: inherit;
    color: #1e293b;
    --flow-dash-step: var(--tx-flow-dash-step);
    --flow-grid-dot: var(--tx-flow-grid-dot);
    --flow-line-h: var(--tx-flow-line-h);
}

.tx-flow-demo__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
    padding: 0.45em 0.65em;
    border-bottom: 1px solid #e8ecf1;
    background: #fafbfc;
}

.tx-flow-demo__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-weight: 700;
    font-size: 0.62em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #334155;
}

.tx-flow-demo__dot {
    width: var(--tx-flow-dot-size, 7px);
    height: var(--tx-flow-dot-size, 7px);
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 calc(var(--tx-flow-dot-size, 7px) * 0.28) rgba(245, 158, 11, 0.25);
    animation: txFlowPulse 2s ease-in-out infinite;
}

.tx-flow-demo__live {
    font-size: 0.58em;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #94a3b8;
    text-transform: uppercase;
}

.tx-flow-demo__prompt {
    margin: 0;
    padding: 0.4em 0.65em;
    font-size: 0.68em;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}

.tx-flow-demo__prompt span {
    color: var(--tx-primary, #6d28d9);
    font-weight: 700;
    margin-right: 0.25em;
}

.tx-flow-demo__canvas {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(1.1em, 2.5fr) auto minmax(1.1em, 2fr) minmax(0, 1.35fr);
    align-items: center;
    gap: clamp(0.1em, 0.6vw, 0.35em);
    padding: 0.65em 0.5em 0.75em;
    min-height: var(--tx-flow-canvas-min-h, 118px);
    background-color: #fff;
    background-image: radial-gradient(circle, #d1d5db 0.8px, transparent 0.8px);
    background-size: var(--tx-flow-grid-dot, 12px) var(--tx-flow-grid-dot, 12px);
}

.tx-flow-demo__node {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    padding: 0.35em 0.45em;
    border-radius: var(--tx-flow-radius-sm, 8px);
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.25s;
}

.tx-flow-demo__node strong {
    font-size: 0.62em;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.tx-flow-demo__node small {
    font-size: 0.55em;
    color: #64748b;
    white-space: nowrap;
}

.tx-flow-demo__node--src {
    min-width: 3.6em;
}

.tx-flow-demo__router {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.08em;
    min-width: 4.2em;
    padding: 0.4em 0.5em;
    border-radius: var(--tx-flow-radius-sm, 8px);
    background: #0f172a;
    color: #fff;
    text-align: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.tx-flow-demo__router strong {
    font-size: 0.58em;
    letter-spacing: 0.05em;
}

.tx-flow-demo__router small {
    font-size: 0.5em;
    opacity: 0.78;
    color: #e2e8f0;
}

.tx-flow-demo__dests {
    display: flex;
    flex-direction: column;
    gap: 0.28em;
    min-width: 0;
}

.tx-flow-demo__node--dest.is-active {
    border-color: var(--tx-primary, #6d28d9);
    background: color-mix(in srgb, var(--tx-primary, #6d28d9) 10%, #fff);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--tx-primary, #6d28d9) 35%, transparent),
        0 4px 14px color-mix(in srgb, var(--tx-primary, #6d28d9) 18%, transparent);
    transform: translateX(2px);
}

.tx-flow-demo__line {
    height: var(--flow-line-h, var(--tx-flow-line-h, 2px));
    align-self: center;
    border-radius: 1px;
    background: repeating-linear-gradient(
        90deg,
        #94a3b8 0,
        #94a3b8 calc(var(--flow-grid-dot, 12px) * 0.42),
        transparent calc(var(--flow-grid-dot, 12px) * 0.42),
        transparent calc(var(--flow-grid-dot, 12px) * 0.75)
    );
    background-size: var(--flow-dash-step, 18px) var(--flow-line-h, 2px);
    animation: txFlowDash 0.9s linear infinite;
}

.tx-flow-demo__line--dash {
    width: 100%;
}

.tx-flow-demo__line--fan {
    width: 100%;
    opacity: 0.85;
}

.tx-flow-demo.is-active .tx-flow-demo__line--dash {
    background: repeating-linear-gradient(
        90deg,
        var(--tx-primary, #6d28d9) 0,
        var(--tx-primary, #6d28d9) calc(var(--flow-grid-dot, 12px) * 0.42),
        transparent calc(var(--flow-grid-dot, 12px) * 0.42),
        transparent calc(var(--flow-grid-dot, 12px) * 0.75)
    );
    background-size: var(--flow-dash-step, 18px) var(--flow-line-h, 2px);
}

.tx-flow-demo__metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid #e8ecf1;
    background: #fafbfc;
}

.tx-flow-demo__metric {
    padding: 0.4em 0.35em;
    text-align: center;
    border-right: 1px solid #e8ecf1;
}

.tx-flow-demo__metric:last-child {
    border-right: 0;
}

.tx-flow-demo__metric span {
    display: block;
    font-size: 0.52em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.15em;
}

.tx-flow-demo__metric strong {
    display: block;
    font-size: 0.72em;
    font-weight: 700;
    color: #0f172a;
    transition: color 0.2s;
}

.tx-flow-demo.is-active .tx-flow-demo__metric strong {
    color: var(--tx-primary-dark, #5b21b6);
}

@keyframes txFlowDash {
    to {
        background-position: var(--flow-dash-step, 18px) 0;
    }
}

@keyframes txFlowPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.55;
    }
}

@media (max-width: 1100px) {
    .sl-app-panel-head-main {
        flex-basis: 46%;
        max-width: 54%;
    }

    .sl-app-panel-flow {
        flex-basis: clamp(11.25rem, 32vw, 25rem);
        max-width: clamp(11.25rem, 36vw, 25rem);
        min-width: clamp(10rem, 18vw, 13.125rem);
    }
}

@media (max-width: 900px) {
    .sl-app-panel-flow {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        min-width: 0;
        order: -1;
        margin-bottom: 0.5em;
    }

    .tx-flow-demo__canvas {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        gap: 0.35em;
        min-height: 0;
    }

    .tx-flow-demo__line {
        width: var(--flow-line-h, 2px);
        height: calc(var(--flow-dash-step, 18px) * 0.78);
        margin: 0 auto;
        background: repeating-linear-gradient(
            180deg,
            #94a3b8 0,
            #94a3b8 calc(var(--flow-grid-dot, 12px) * 0.42),
            transparent calc(var(--flow-grid-dot, 12px) * 0.42),
            transparent calc(var(--flow-grid-dot, 12px) * 0.75)
        );
        background-size: var(--flow-line-h, 2px) var(--flow-dash-step, 18px);
        animation-name: txFlowDashV;
    }

    @keyframes txFlowDashV {
        to {
            background-position: 0 var(--flow-dash-step, 18px);
        }
    }

    .tx-flow-demo__dests {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .tx-flow-demo__node--dest {
        flex: 1 1 calc(50% - 0.25em);
        min-width: 0;
    }

    .tx-flow-demo__node strong,
    .tx-flow-demo__node small,
    .tx-flow-demo__router strong,
    .tx-flow-demo__router small {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tx-flow-demo__node--src,
    .tx-flow-demo__router {
        min-width: 0;
        width: 100%;
        max-width: 16em;
        margin-inline: auto;
    }
}

@media (max-width: 600px) {
    .tx-flow-demo__badge {
        flex-wrap: wrap;
    }

    .tx-flow-demo__live {
        flex-shrink: 0;
    }

    .tx-flow-demo__node--dest {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tx-flow-demo__line,
    .tx-flow-demo__dot,
    .tx-flow-hub__path,
    .tx-flow-hub__pulse {
        animation: none;
    }

    .tx-flow-demo__node--dest {
        transition: none;
    }
}

/* ---- Kế toán hub: Tổng hợp ← 11 module → Sổ sách (luồng đồng thời) ---- */
.tx-flow-hub .tx-flow-hub__stage {
    position: relative;
    margin: 0;
    padding: 0.35em 0.25em 0.5em;
    min-height: var(--tx-flow-hub-min-h, 7rem);
    aspect-ratio: 5 / 4;
    background-color: #fff;
    background-image: radial-gradient(circle, #d1d5db 0.8px, transparent 0.8px);
    background-size: var(--tx-flow-grid-dot, 12px) var(--tx-flow-grid-dot, 12px);
    overflow: hidden;
}

.tx-flow-hub__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--tx-primary, #6d28d9);
    pointer-events: none;
}

.tx-flow-hub__path {
    fill: none;
    stroke: currentColor;
    stroke-width: 0.55;
    stroke-linecap: round;
    opacity: 0.35;
}

.tx-flow-hub__path--in {
    stroke-dasharray: 2.2 1.8;
    animation: txHubDashIn 1.1s linear infinite;
}

.tx-flow-hub__path--out {
    stroke: #059669;
    color: #059669;
    stroke-width: 0.65;
    stroke-dasharray: 2.4 1.6;
    animation: txHubDashOut 1s linear infinite;
}

.tx-flow-hub__pulse {
    fill: var(--tx-primary, #6d28d9);
    opacity: 0.9;
}

.tx-flow-hub__pulse--out {
    fill: #059669;
}

.tx-flow-hub__node {
    position: absolute;
    z-index: 2;
    transform: translate(-50%, -50%);
    max-width: 5.8em;
    padding: 0.28em 0.38em;
    border-radius: var(--tx-flow-radius-sm, 7px);
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    text-align: center;
}

.tx-flow-hub__node strong {
    display: block;
    font-size: 0.52em;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
}

.tx-flow-hub__node small {
    display: block;
    margin-top: 0.08em;
    font-size: 0.46em;
    color: #64748b;
    line-height: 1.2;
}

.tx-flow-hub__node--hub {
    max-width: 4.6em;
    padding: 0.38em 0.45em;
    border-color: #0f172a;
    background: #0f172a;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
}

.tx-flow-hub__node--hub strong {
    color: #fff;
    font-size: 0.58em;
}

.tx-flow-hub__node--hub small {
    color: rgba(255, 255, 255, 0.78);
}

.tx-flow-hub__node--out {
    max-width: 5.2em;
    border-color: #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.18);
}

.tx-flow-hub__node--out strong {
    color: #047857;
}

.tx-flow-hub__metrics strong {
    color: var(--tx-primary-dark, #5b21b6);
}

.tx-flow-demo.is-active .tx-flow-hub__path--in {
    opacity: 0.72;
}

.tx-flow-demo.is-active .tx-flow-hub__path--out {
    opacity: 0.85;
}

@keyframes txHubDashIn {
    to {
        stroke-dashoffset: -8;
    }
}

@keyframes txHubDashOut {
    to {
        stroke-dashoffset: -8;
    }
}

/* ---- Hóa đơn điện tử: pipeline trái → phải (luồng đồng thời) ---- */
.tx-flow-invoice .tx-flow-hub__stage {
    min-height: calc(var(--tx-flow-hub-min-h, 220px) * 0.92);
    aspect-ratio: 16 / 10;
}

.tx-flow-hub__path--branch {
    stroke: #2563eb;
    color: #2563eb;
    stroke-width: 0.58;
    stroke-dasharray: 2.2 1.8;
    animation: txHubDashIn 1.05s linear infinite;
}

.tx-flow-hub__path--draft {
    stroke: #94a3b8;
    color: #64748b;
    stroke-width: 0.5;
    stroke-dasharray: 1.8 2;
    animation: txHubDashIn 1.2s linear infinite;
    opacity: 0.55;
}

.tx-flow-hub__path--mid {
    stroke: var(--tx-primary, #6d28d9);
    color: var(--tx-primary, #6d28d9);
    stroke-width: 0.6;
    stroke-dasharray: 2.2 1.8;
    animation: txHubDashIn 1s linear infinite;
}

.tx-flow-hub__pulse--draft {
    fill: #64748b;
}

.tx-flow-hub__node--process {
    border-color: #c4b5fd;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}

.tx-flow-hub__node--process strong {
    color: #5b21b6;
}

.tx-flow-hub__node--draft {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.tx-flow-hub__node--draft strong {
    color: #475569;
}

.tx-flow-hub__node--cqt {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
}

.tx-flow-hub__node--cqt strong {
    color: #b45309;
}

.tx-flow-demo.is-active .tx-flow-hub__path--branch,
.tx-flow-demo.is-active .tx-flow-hub__path--mid {
    opacity: 0.78;
}

.tx-flow-demo.is-active .tx-flow-hub__path--draft {
    opacity: 0.65;
}

.tx-flow-tncn .tx-flow-hub__node--tncn {
    border-color: #c2410c;
    background: linear-gradient(135deg, #9a3412 0%, #ea580c 55%, #fb923c 100%);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.28);
}

.tx-flow-tncn .tx-flow-hub__node--tncn strong {
    color: #fff;
}

.tx-flow-tncn .tx-flow-hub__node--tncn small {
    color: rgba(255, 255, 255, 0.85);
}

/* ---- Tải HĐ CQT: NCC → 7 loại → GDT → Assistant → đích (luồng đồng thời) ---- */
.tx-flow-download .tx-flow-download__stage,
.tx-flow-download .tx-flow-hub__stage {
    min-height: var(--tx-flow-hub-min-h-lg, 240px);
    aspect-ratio: 18 / 10;
}

.tx-flow-download .tx-flow-hub__node {
    max-width: 4.6em;
    padding: 0.22em 0.32em;
}

.tx-flow-download .tx-flow-hub__node strong {
    font-size: 0.48em;
    line-height: 1.2;
    white-space: normal;
}

.tx-flow-download .tx-flow-hub__node small {
    font-size: 0.42em;
}

.tx-flow-hub__node--src {
    max-width: 4em;
    border-color: #0ea5e9;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.tx-flow-hub__node--src strong {
    color: #0369a1;
}

.tx-flow-hub__node--entity {
    max-width: 3.6em;
    border-color: #7dd3fc;
    background: #f0f9ff;
}

.tx-flow-hub__node--entity strong {
    color: #0284c7;
}

.tx-flow-hub__node--type {
    max-width: 4.2em;
    padding: 0.18em 0.28em;
    border-color: #cbd5e1;
    background: #fff;
}

.tx-flow-hub__node--type strong {
    font-size: 0.44em;
}

.tx-flow-hub__node--portal {
    max-width: 4.8em;
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.2);
}

.tx-flow-hub__node--portal strong {
    color: #b45309;
    font-size: 0.5em;
}

.tx-flow-hub__node--portal small {
    color: #92400e;
}

.tx-flow-hub__node--assistant {
    max-width: 4.4em;
    border-color: #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.tx-flow-hub__node--assistant strong {
    color: #047857;
}

.tx-flow-hub__node--format {
    max-width: 2.8em;
    min-width: 2.4em;
    border-color: #a78bfa;
    background: #f5f3ff;
}

.tx-flow-hub__node--format strong {
    color: #6d28d9;
    font-size: 0.52em;
}

.tx-flow-risk .tx-flow-risk__stage,
.tx-flow-risk .tx-flow-hub__stage {
    min-height: calc(var(--tx-flow-hub-min-h-lg, 240px) * 0.96);
    aspect-ratio: 16 / 10;
}

.tx-flow-hub__node--risk {
    max-width: 4.6em;
    border-color: #dc2626;
    background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 55%, #ef4444 100%);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.28);
}

.tx-flow-hub__node--risk strong {
    color: #fff;
    font-size: 0.52em;
}

.tx-flow-hub__node--risk small {
    color: rgba(255, 255, 255, 0.85);
}

.tx-flow-lookup .tx-flow-lookup__stage,
.tx-flow-lookup .tx-flow-hub__stage {
    min-height: var(--tx-flow-hub-min-h, 220px);
    aspect-ratio: 17 / 10;
}

@media (max-width: 900px) {
    .tx-flow-hub .tx-flow-hub__stage,
    .tx-flow-invoice .tx-flow-hub__stage,
    .tx-flow-download .tx-flow-hub__stage,
    .tx-flow-risk .tx-flow-hub__stage,
    .tx-flow-lookup .tx-flow-hub__stage {
        aspect-ratio: auto;
    }
}

html[data-theme="dark"] .tx-flow-demo {
    background: var(--tx-surface, #1e1e1e);
    border-color: var(--tx-border, #333);
    color: var(--tx-text, #e0e0e0);
}

html[data-theme="dark"] .tx-flow-demo__head,
html[data-theme="dark"] .tx-flow-demo__metrics {
    background: var(--tx-bg-alt, #1a1a1a);
    border-color: var(--tx-border, #333);
}

html[data-theme="dark"] .tx-flow-demo__node {
    background: var(--tx-surface, #1e1e1e);
    border-color: var(--tx-border, #333);
}

html[data-theme="dark"] .tx-flow-demo__node strong,
html[data-theme="dark"] .tx-flow-demo__metric strong {
    color: var(--tx-text, #e0e0e0);
}

html[data-theme="dark"] .tx-flow-hub .tx-flow-hub__stage {
    background-color: var(--tx-surface, #1e1e1e);
    background-image: radial-gradient(circle, #333 0.8px, transparent 0.8px);
}

html[data-theme="dark"] .tx-flow-hub__node {
    background: rgba(30, 30, 30, 0.96);
    border-color: var(--tx-border, #333);
}

html[data-theme="dark"] .tx-flow-hub__node strong {
    color: var(--tx-text, #e0e0e0);
}

html[data-theme="dark"] .tx-flow-hub__node--hub {
    background: #0f172a;
    border-color: #334155;
}

html[data-theme="dark"] .tx-flow-hub__node--out {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #059669;
}

html[data-theme="dark"] .tx-flow-hub__node--out strong {
    color: #a7f3d0;
}

html[data-theme="dark"] .tx-flow-hub__node--process {
    background: linear-gradient(135deg, #2e1065 0%, #1e1b4b 100%);
    border-color: #5b21b6;
}

html[data-theme="dark"] .tx-flow-hub__node--process strong {
    color: #ddd6fe;
}

html[data-theme="dark"] .tx-flow-hub__node--draft {
    background: var(--tx-bg-alt, #1a1a1a);
    border-color: var(--tx-border, #444);
}

html[data-theme="dark"] .tx-flow-hub__node--cqt {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: #d97706;
}

html[data-theme="dark"] .tx-flow-hub__node--cqt strong {
    color: #fde68a;
}

html[data-theme="dark"] .tx-flow-tncn .tx-flow-hub__node--tncn {
    background: linear-gradient(135deg, #7c2d12 0%, #c2410c 100%);
    border-color: #ea580c;
}

html[data-theme="dark"] .tx-flow-hub__node--src {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
    border-color: #0284c7;
}

html[data-theme="dark"] .tx-flow-hub__node--src strong {
    color: #e0f2fe;
}

html[data-theme="dark"] .tx-flow-hub__node--entity {
    background: var(--tx-bg-alt, #1a1a1a);
    border-color: #0369a1;
}

html[data-theme="dark"] .tx-flow-hub__node--entity strong {
    color: #7dd3fc;
}

html[data-theme="dark"] .tx-flow-hub__node--portal {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: #d97706;
}

html[data-theme="dark"] .tx-flow-hub__node--portal strong {
    color: #fde68a;
}

html[data-theme="dark"] .tx-flow-hub__node--risk {
    background: linear-gradient(135deg, #450a0a 0%, #991b1b 100%);
    border-color: #ef4444;
}

/* K? toán HKD TT58 — hub s? sách */
.tx-flow-hkd .tx-flow-hub__node--hub {
    background: linear-gradient(145deg, #14b8a6 0%, #0f766e 60%, #115e59 100%);
    border-color: #0f766e;
    color: #fff;
}
.tx-flow-hkd .tx-flow-hub__node--hub strong,
.tx-flow-hkd .tx-flow-hub__node--hub small {
    color: #fff;
}
.tx-flow-hkd .tx-flow-hub__path--in {
    stroke: #0f766e;
    color: #0f766e;
}
.tx-flow-hkd .tx-flow-hub__path--out {
    stroke: #0369a1;
    color: #0369a1;
}
