/* ========== LHE — Liquidity Hydrodynamic Engine page (Cyber-Noir) ========== */
/* Routed PAGE inside #lhePage.riskmodel-page (.active toggles it). Reuses
   .macro-page-header / .macro-content for the title bar + layout.
   TEXT POLICY: everything uses --text-primary (bright/white in dark mode, adapts
   in day mode) for sharp readability — colored accents (green/red/cyan) only carry
   meaning (direction, severity). No dim gray body text. */

.lhe-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.lhe-subtitle { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--text-primary); max-width: 780px; }
.lhe-refresh {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
    padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; font-weight: 600;
    white-space: nowrap; transition: all 0.15s;
}
.lhe-refresh:hover { color: var(--accent-blue); border-color: var(--accent-blue); background: var(--bg-card-hover); }
.lhe-body { max-width: 1080px; }
.lhe-loading, .lhe-empty { text-align: center; color: var(--text-primary); padding: 50px 20px; font-size: 0.95rem; line-height: 1.7; }

/* ── Heartbeat status bar ── */
.lhe-meta-bar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 18px; }
.lhe-status-line { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text-primary); font-weight: 600; }
.lhe-live { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.lhe-live-on { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); animation: lhePulse 2s infinite; }
.lhe-live-warn { background: var(--accent-orange); box-shadow: 0 0 8px var(--accent-orange); }
@keyframes lhePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.lhe-status-sub { font-size: 0.82rem; color: var(--text-primary); opacity: 0.85; margin-top: 4px; }
.lhe-status-note { font-size: 0.84rem; color: var(--accent-blue); margin-top: 6px; font-weight: 600; }

/* ── Semantic accent colors (arrows / values only) ── */
.lhe-pos { color: var(--accent-green) !important; }
.lhe-neg { color: var(--accent-red) !important; }
.lhe-neu { color: var(--accent-blue) !important; }

/* ── Macro panel (HPI gauge + flow) ── */
.lhe-macro { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 20px; }
.lhe-macro-top { display: grid; grid-template-columns: 1fr 200px; gap: 22px; align-items: center; }
@media (max-width: 720px) { .lhe-macro-top { grid-template-columns: 1fr; } }
.lhe-gauge-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lhe-gauge-lbl { font-size: 0.86rem; color: var(--text-primary); font-weight: 700; }
.lhe-regime { font-size: 0.84rem; font-weight: 800; padding: 3px 10px; border-radius: 20px; border: 1px solid currentColor; }
.lhe-gauge-bar { position: relative; height: 10px; border-radius: 6px; direction: ltr; background: linear-gradient(90deg, #ff4d4d 0%, #f59e0b 30%, #00e5ff 50%, #00ff94 100%); }
.lhe-gauge-marker { position: absolute; top: -4px; width: 4px; height: 18px; border-radius: 2px; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.95); }
.lhe-gauge-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.lhe-gauge-score { font-size: 1.85rem; font-weight: 800; line-height: 1; }
.lhe-gauge-score small { font-size: 0.9rem; color: var(--text-primary); opacity: 0.7; font-weight: 500; }
.lhe-gauge-delta { font-size: 0.84rem; font-weight: 700; }
.lhe-flow { text-align: center; border-right: 1px solid var(--border); padding-right: 18px; }
@media (max-width: 720px) { .lhe-flow { border-right: none; border-top: 1px solid var(--border); padding: 14px 0 0; } }
.lhe-flow-lbl { font-size: 0.82rem; color: var(--text-primary); font-weight: 600; }
.lhe-flow-val { font-size: 1.55rem; font-weight: 800; margin: 4px 0; }
.lhe-flow-val small { font-size: 0.72rem; color: var(--text-primary); opacity: 0.7; font-weight: 500; margin-right: 3px; }
.lhe-flow-sub { font-size: 0.74rem; color: var(--text-primary); opacity: 0.75; }
.lhe-macro-body { font-size: 0.9rem; line-height: 1.7; color: var(--text-primary); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ── Broad liquidity factors ── */
.lhe-cond-title, .lhe-rank-title, .lhe-map-title { font-size: 0.86rem; font-weight: 800; color: var(--text-primary); margin: 18px 0 10px; }
.lhe-conds { display: flex; flex-wrap: wrap; gap: 8px; }
.lhe-cond { font-size: 0.8rem; color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 18px; padding: 5px 12px; font-weight: 600; }
.lhe-cond b { font-weight: 800; }
.lhe-cond-arrow { margin-inline-start: 5px; font-size: 0.72rem; }

/* ── Liquidity MAP (where the money is) ── */
.lhe-map { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 20px; }
.lhe-map-title { margin-top: 0; }
.lhe-map-sub { font-size: 0.82rem; color: var(--text-primary); margin-bottom: 14px; font-weight: 600; }
.lhe-map-sub b { color: var(--accent-blue); }
.lhe-map-row { display: grid; grid-template-columns: 200px 1fr 96px; align-items: center; gap: 12px; margin-bottom: 8px; }
@media (max-width: 600px) { .lhe-map-row { grid-template-columns: 130px 1fr 78px; gap: 8px; } }
.lhe-map-label { font-size: 0.84rem; color: var(--text-primary); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.lhe-map-live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); flex-shrink: 0; }
.lhe-map-est { color: var(--text-primary); opacity: 0.6; font-weight: 700; flex-shrink: 0; }
.lhe-map-track { height: 14px; background: var(--bg-surface); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.lhe-map-fill { display: block; height: 100%; border-radius: 6px; }
.lhe-g-market { background: linear-gradient(90deg, #00e5ff, #38bdf8); }
.lhe-g-bonds { background: linear-gradient(90deg, #c084fc, #a855f7); }
.lhe-g-cash { background: linear-gradient(90deg, #00ff94, #22c55e); }
.lhe-map-val { font-size: 0.86rem; font-weight: 800; color: var(--text-primary); text-align: left; font-variant-numeric: tabular-nums; }

/* ── Conduit ranking ── */
.lhe-rank { display: flex; flex-direction: column; gap: 7px; }
.lhe-rank-row { display: grid; grid-template-columns: 22px 56px 1fr 80px; align-items: center; gap: 10px; }
.lhe-rank-num { font-size: 0.8rem; color: var(--text-primary); font-weight: 800; text-align: center; }
.lhe-rank-tk { font-size: 0.86rem; font-weight: 800; color: var(--text-primary); }
.lhe-rank-track { height: 9px; background: var(--bg-surface); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.lhe-rank-fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent-blue), var(--accent-green)); }
.lhe-rank-val { font-size: 0.84rem; font-weight: 800; color: var(--text-primary); text-align: left; }
.lhe-rank-val small { color: var(--text-primary); opacity: 0.7; font-weight: 600; }

/* ── Asset cards ── */
.lhe-cards-title { font-size: 0.95rem; font-weight: 800; color: var(--text-primary); margin: 6px 0 12px; }
.lhe-cards { display: flex; flex-direction: column; gap: 12px; }
.lhe-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; transition: border-color 0.15s; }
.lhe-card:hover { border-color: var(--border-hover); }
.lhe-card-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; cursor: pointer; gap: 12px; }
.lhe-card-head-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lhe-caret { color: var(--text-primary); opacity: 0.6; font-size: 0.85rem; transition: transform 0.2s; flex-shrink: 0; }
.lhe-card:not(.collapsed) .lhe-caret { transform: rotate(90deg); }
.lhe-card-bias { font-size: 1.15rem; flex-shrink: 0; }
.lhe-card-id { display: flex; flex-direction: column; min-width: 0; }
.lhe-card-tk { font-size: 1.02rem; font-weight: 800; color: var(--text-primary); }
.lhe-card-name { font-size: 0.8rem; color: var(--text-primary); opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lhe-card-head-r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lhe-fit-chip { font-size: 0.72rem; font-weight: 800; padding: 4px 9px; border-radius: 14px; white-space: nowrap; }
.lhe-fit-tailwind { background: rgba(0, 255, 148, 0.14); color: var(--accent-green); border: 1px solid rgba(0, 255, 148, 0.4); }
.lhe-fit-headwind { background: rgba(255, 77, 77, 0.14); color: var(--accent-red); border: 1px solid rgba(255, 77, 77, 0.4); }
.lhe-fit-neutral { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); }
.lhe-conf { font-size: 0.8rem; font-weight: 800; padding: 5px 12px; border-radius: 20px; }
.lhe-sev-crit { background: rgba(255, 77, 77, 0.18); color: var(--accent-red); border: 1px solid var(--accent-red); }
.lhe-sev-high { background: rgba(245, 158, 11, 0.18); color: var(--accent-orange); border: 1px solid var(--accent-orange); }
.lhe-sev-elev { background: rgba(0, 229, 255, 0.16); color: var(--accent-blue); border: 1px solid rgba(0, 229, 255, 0.45); }
.lhe-sev-info { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); }

.lhe-card-body { max-height: 1600px; padding: 0 18px 16px; transition: max-height 0.3s ease, opacity 0.2s, padding 0.2s; }
.lhe-card.collapsed .lhe-card-body { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden; }

/* macro-fit banner (does the macro favor THIS asset) */
.lhe-fit { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 12px; border: 1px solid; flex-wrap: wrap; }
.lhe-fit b { font-weight: 800; }
.lhe-fit small { color: var(--text-primary); opacity: 0.92; font-weight: 500; }
.lhe-fit.lhe-fit-tailwind { background: rgba(0, 255, 148, 0.08); border-color: rgba(0, 255, 148, 0.3); }
.lhe-fit.lhe-fit-headwind { background: rgba(255, 77, 77, 0.08); border-color: rgba(255, 77, 77, 0.3); }
.lhe-fit.lhe-fit-neutral { background: var(--bg-surface); border-color: var(--border); }

.lhe-stats { display: flex; gap: 10px; margin-bottom: 12px; }
.lhe-stat { flex: 1; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 6px; text-align: center; }
.lhe-stat-v { display: block; font-size: 1.05rem; font-weight: 800; color: var(--text-primary); }
.lhe-stat-l { display: block; font-size: 0.72rem; color: var(--text-primary); opacity: 0.8; margin-top: 2px; font-weight: 600; }

.lhe-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lhe-flag { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 14px; background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); }
.lhe-flag-mss { background: rgba(192, 132, 252, 0.16); color: var(--accent-purple); border-color: rgba(192, 132, 252, 0.4); }

.lhe-card-narrative { font-size: 0.88rem; line-height: 1.75; color: var(--text-primary); white-space: pre-line; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }

.lhe-target { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; background: rgba(0, 255, 148, 0.07); border: 1px solid rgba(0, 255, 148, 0.28); border-radius: var(--radius-sm); }
.lhe-target-lbl { font-size: 0.82rem; font-weight: 800; color: var(--accent-green); }
.lhe-target-zone { font-size: 0.92rem; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.lhe-target-meta { font-size: 0.78rem; color: var(--text-primary); opacity: 0.9; margin-right: auto; font-weight: 600; }

.lhe-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.lhe-act { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.15s; }
.lhe-act:hover { color: var(--accent-blue); border-color: var(--accent-blue); background: var(--bg-card-hover); }
