/* v18.25 – Giao diện tối (bật/tắt bằng nút mặt trời/mặt trăng trên thanh trên cùng; lưu trên máy đang dùng).
   Chỉ áp dụng trên màn hình — khi in / xuất PDF vẫn dùng giao diện sáng. */
@media screen {
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b16; --panel: #0e1527; --ink: #e8ecf5; --muted: #8390ab; --line: #1e2a45; --line2: #18233d;
  --brand: #070b16; --brand-2: #fb8640; --accent: #f0923a; --ok: #4fbf84; --warn: #e0a84a; --bad: #f07272; --info: #6aa7e8;
  --ok-bg: #173527; --warn-bg: #3a2e17; --bad-bg: #3d1d1f; --info-bg: #172d45; --crit: #f07272;
  --sh: 0 1px 2px #0006, 0 0 0 1px #ffffff05; --sh-pop: 0 20px 48px -12px #000000b3, 0 0 0 1px #ffffff0f;
  --panel-2: #121b31; --panel-3: #18233d; --ink-2: #b8c1d6; --muted-2: #5d6a86; --line-strong: #2a3858; --row-hover: #131d34; --row-sel: #2a1a12;
  --brand-50: #2a1a12; --brand-ink: #ffb58a; --brand-line: #7a3a17; --brand-600: #fb8640; --brand-400: #ff9d5c; --accent: #f26a23;
  --nav: #070b16; --nav-2: #0e1527; --nav-line: #1e2a45; --nav-on: #1b2444;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] a { color: #fb8640; }
html[data-theme="dark"] .side { background: #070b16; border-right: 1px solid #1e2a45; }
html[data-theme="dark"] .side nav a.on { background: #1b2444; color: #fff; }
html[data-theme="dark"] .top { background: rgba(10,15,29,.72); border-bottom-color: var(--line); }
html[data-theme="dark"] button, html[data-theme="dark"] .btn { background: #121b31; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] button:hover, html[data-theme="dark"] .btn:hover { border-color: #2a3858; }
html[data-theme="dark"] button.primary, html[data-theme="dark"] .btn.primary { background: #f26a23; border-color: #f26a23; color: #fff; }
html[data-theme="dark"] button.primary:hover { background: #dc5212; }
html[data-theme="dark"] button.danger { background: #121b31; border-color: #6b3036; color: var(--bad); }
html[data-theme="dark"] button.warn { background: #121b31; border-color: #6b5326; color: var(--warn); }
html[data-theme="dark"] button.link { background: none; border: 0; color: #fb8640; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0b1122; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #66778b; }
html[data-theme="dark"] table.t, html[data-theme="dark"] .tw, html[data-theme="dark"] .gantt-wrap { background: var(--panel); }
html[data-theme="dark"] table.t th, html[data-theme="dark"] table.gantt thead th { background: #121b31; color: var(--muted); }
html[data-theme="dark"] table.t td { border-color: var(--line2); }
html[data-theme="dark"] table.t tr.click:hover td, html[data-theme="dark"] table.gantt tr.click:hover td { background: #131d34; }
html[data-theme="dark"] table.t tr.sum td, html[data-theme="dark"] table.gantt tr.sumrow.lv1 td { background: #1d2b3d; color: #cfe0f5; }
html[data-theme="dark"] table.t tr.on td { background: #33281a; }
html[data-theme="dark"] table.gantt th, html[data-theme="dark"] table.gantt td, html[data-theme="dark"] table.gantt tr.sumrow.lv0 td.chart, html[data-theme="dark"] table.gantt tr.sumrow.lv1 td.chart { background: var(--panel); }
html[data-theme="dark"] table.gantt tr.sumrow td { background: #121b31; }
html[data-theme="dark"] .gantt-horizontal-bar { background: #121b31; border-color: var(--line); }
html[data-theme="dark"] .modal { background: var(--panel); color: var(--ink); }
html[data-theme="dark"] .modal.is-draggable > header, html[data-theme="dark"] .modal > header { background: #121b31; border-color: var(--line); }
html[data-theme="dark"] .modal footer { border-color: var(--line); }
html[data-theme="dark"] .badge { background: #18233d; color: #b8c1d6; }
html[data-theme="dark"] .b-draft { background: #18233d; color: #b8c1d6; }
html[data-theme="dark"] details.formula, html[data-theme="dark"] .planned-calculation-results, html[data-theme="dark"] .daily-quantity-meta, html[data-theme="dark"] .daily-quantity-selectors,
html[data-theme="dark"] .mail-types label, html[data-theme="dark"] .mail-test, html[data-theme="dark"] .mail-preview { background: #121b31; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .photos a { background: #121b31; }
html[data-theme="dark"] .notif a:hover { background: #131d34; }
html[data-theme="dark"] .qltc-quick-panel { background: var(--panel); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .qltc-quick-header { background: #121b31; border-color: var(--line); }
html[data-theme="dark"] .qltc-quick-header small { color: var(--muted); }
html[data-theme="dark"] .qltc-quick-item { border-color: var(--line2); }
html[data-theme="dark"] .qltc-quick-item:hover { background: #131d34; }
html[data-theme="dark"] .progress-entry-preview { background: #173527; border-color: #23523a; color: #8fe0b3; }
html[data-theme="dark"] .mail-status.ok { background: #173527; color: #8fe0b3; }
html[data-theme="dark"] .mail-status.bad { background: #3d1d1f; color: #f5a3a3; }
html[data-theme="dark"] .mail-status.neutral { background: #18233d; color: #b8c1d6; }
html[data-theme="dark"] .brand-mark { background: #fff; }
/* Bản vẽ, ảnh, sơ đồ mặt bằng giữ màu gốc */
html[data-theme="dark"] .siteplan-canvas, html[data-theme="dark"] .site-plan-viewer { background: #fff; }
/* Bàn giao sản phẩm */
html[data-theme="dark"] .ho-cell[style*="d3d9e4"] { --c: #2a3858 !important; }
html[data-theme="dark"] .ho-funnel .bar { background: #18233d; }
html[data-theme="dark"] .ho-funnel .bar i { background: #6b3a1f; }
html[data-theme="dark"] .ho-funnel .bar b { background: #fb8640; }
html[data-theme="dark"] .ho-selbar { background: #070b16; border: 1px solid var(--line); }
html[data-theme="dark"] .ho-legend i.late { background: transparent; }
html[data-theme="dark"] .ho-cell.late.handed { box-shadow: inset 0 0 0 2px #0e1527, inset 0 0 0 4px var(--bad); }
/* Thanh biểu tượng */
html[data-theme="dark"] .ticon { color: #b8c1d6; }
html[data-theme="dark"] .ticon:hover { background: #131d34; color: #fff; }
html[data-theme="dark"] .top-pop { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .top-pop a:hover, html[data-theme="dark"] .top-pop button:hover { background: #131d34; }
}
@media screen {
html[data-theme="dark"] button.ho-cell { background: var(--c, #2a3858); border: 0; }
html[data-theme="dark"] button.ho-cell[style*="d3d9e4"] { background: #2a3858; }
html[data-theme="dark"] button.ticon { background: transparent; border: 0; }
html[data-theme="dark"] button.ticon.gear { background: #3a2a19; color: #f0a35a; }
html[data-theme="dark"] button.pop-item { background: transparent; border: 0; }
html[data-theme="dark"] .ho-seg button.on { background: #f26a23; color: #fff; }
html[data-theme="dark"] .ho-legend i[style*="d3d9e4"] { background: #2a3858 !important; }
html[data-theme="dark"] .qltc-assistant-greeting { background: #1b2444; color: #fff; }
}
@media screen {
html[data-theme="dark"] .top { background: rgba(10,15,29,.72); }
html[data-theme="dark"] .side { background: #070b16; border-right-color: #1e2a45; }
html[data-theme="dark"] .side .logo { border-color: #1e2a45; }
html[data-theme="dark"] button.ticon.gear:hover { background: #2a1a12; color: #fb8640; }
html[data-theme="dark"] .ho-seg button.on { background: #f26a23; color: #fff; }
html[data-theme="dark"] .ho-kpi::after { background: #18233d; }
html[data-theme="dark"] .tabs a.on { color: #e8ecf5; }
html[data-theme="dark"] .modal header, html[data-theme="dark"] .modal.is-draggable > header { background: #0e1527; }
html[data-theme="dark"] a { color: #fb8640; }
html[data-theme="dark"] .side nav a { color: #a3acc7; }
html[data-theme="dark"] .side nav a.on { color: #fff; }
html[data-theme="dark"] .b-ok, html[data-theme="dark"] .b-approved, html[data-theme="dark"] .b-pass { background: #0f2e22; color: #4ade80; }
html[data-theme="dark"] .b-overdue, html[data-theme="dark"] .b-bad, html[data-theme="dark"] .b-rejected, html[data-theme="dark"] .b-fail { background: #3a1416; color: #f87171; }
}
@media screen {
html[data-theme="dark"] .ho-kpi.late { border-color: #7a3a17; }
html[data-theme="dark"] button.ticon.gear { background: transparent; color: #8390ab; }
}
