/* v0.36.0: giao diện tối. Chữ và số quan trọng tương phản cao, nhãn phụ tương phản thấp.
   Giấy báo giá, mẫu báo giá và hợp đồng giữ nền trắng vì đó là bản in. */
body.theme-dark{
 --d-bg:#0b1220;--d-surface:#111a2b;--d-surface-2:#16213a;--d-surface-3:#1b2942;
 --d-line:#1f2b41;--d-line-2:#27364f;
 --d-ink:#e9f0fa;--d-ink-2:#aebdd2;--d-ink-3:#8294ad;
 --d-brand:#3b82f6;--d-brand-soft:#16294a;
 color-scheme:dark;background:var(--d-bg);color:var(--d-ink)}
body.theme-dark .shell,body.theme-dark main{background:var(--d-bg);color:var(--d-ink)}
body.theme-dark h1:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark h2:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark h3:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark h4:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark strong:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark b:not(:is(.quote-paper,.qc-sheet) *){color:var(--d-ink)}
body.theme-dark p:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark li:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark dd:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark span:not(:is(.quote-paper,.qc-sheet) *){color:inherit}
body.theme-dark .muted:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark .hint:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark small:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark .empty,body.theme-dark figcaption:not(:is(.quote-paper,.qc-sheet) *){color:var(--d-ink-3)}
body.theme-dark label:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark .field-label,body.theme-dark legend:not(:is(.quote-paper,.qc-sheet) *){color:var(--d-ink-2)}
body.theme-dark a:not(:is(.quote-paper,.qc-sheet) *){color:#7fb0ff}

/* Khung chính */
body.theme-dark header{background:var(--d-surface);border-bottom-color:var(--d-line)}
body.theme-dark aside{background:#0a101d;color:var(--d-ink-2)}
body.theme-dark nav a,body.theme-dark nav button,body.theme-dark nav details>summary{color:var(--d-ink-2)}
body.theme-dark nav a:hover,body.theme-dark nav button:hover{background:#16233a;color:#fff}
body.theme-dark nav details>summary{background:#0d1526}
body.theme-dark nav .active{background:#16294a;color:#fff}
body.theme-dark .brand{border-bottom-color:#16233a;color:#fff}
body.theme-dark .card,body.theme-dark dialog,body.theme-dark .stat{background:var(--d-surface);border-color:var(--d-line);color:var(--d-ink)}
body.theme-dark dialog::backdrop{background:#03070f9c}
body.theme-dark fieldset{border-color:var(--d-line)}
body.theme-dark .page-head .muted{color:var(--d-ink-3)}

/* Ô nhập và nút */
body.theme-dark input,body.theme-dark select,body.theme-dark textarea{background:var(--d-surface-2);border-color:var(--d-line-2);color:var(--d-ink)}
body.theme-dark input::placeholder,body.theme-dark textarea::placeholder{color:#6e809b}
body.theme-dark input:focus,body.theme-dark select:focus,body.theme-dark textarea:focus{border-color:var(--d-brand);outline-color:var(--d-brand)}
body.theme-dark input:disabled,body.theme-dark select:disabled,body.theme-dark textarea:disabled{background:#131d30;color:#6e809b}
body.theme-dark input[type=checkbox],body.theme-dark input[type=radio]{accent-color:var(--d-brand)}
body.theme-dark button{background:var(--d-surface-2);border-color:var(--d-line-2);color:var(--d-ink)}
body.theme-dark button:hover{background:var(--d-surface-3)}
body.theme-dark .primary,body.theme-dark button.primary{background:var(--d-brand);border-color:var(--d-brand);color:#fff}
body.theme-dark .primary:hover,body.theme-dark button.primary:hover{background:#2f76ee}
body.theme-dark .danger,body.theme-dark .icon-btn.danger{color:#ff8a80}
body.theme-dark .danger-outline{border-color:#5a2b2b;color:#ff8a80}
body.theme-dark .icon-btn,body.theme-dark .drag-handle,body.theme-dark .file-btn{background:var(--d-surface-2);border-color:var(--d-line-2);color:var(--d-ink-2)}
body.theme-dark .icon-btn:hover,body.theme-dark .icon-btn:focus-visible{background:var(--d-brand-soft);border-color:var(--d-brand);color:#cfe0ff}
body.theme-dark .icon-btn.danger:hover{background:#3a1d1d;border-color:#8b3a3a;color:#ffb3ab}

/* Bảng */
body.theme-dark th:not(:is(.quote-paper,.qc-sheet) *){background:var(--d-surface-2);color:var(--d-ink-3)}
body.theme-dark td:not(:is(.quote-paper,.qc-sheet) *),body.theme-dark th:not(:is(.quote-paper,.qc-sheet) *){border-bottom-color:var(--d-line)}
body.theme-dark tbody tr:hover>td:not(:is(.quote-paper,.qc-sheet) *){background:#152034}
body.theme-dark .table-wrap{border-color:var(--d-line)}
body.theme-dark .badge{background:var(--d-surface-3);color:var(--d-ink-2)}
body.theme-dark .badge.ok{background:#12301f;color:#7ee2a8}
body.theme-dark .badge.warn{background:#3a2c12;color:#ffcf7a}

/* Thông báo, cảnh báo */
body.theme-dark .notice{background:#10233f;border-left-color:var(--d-brand);color:var(--d-ink-2)}
body.theme-dark .errors{background:#33260f;border-left-color:#d78918;color:#f2dcb5}
body.theme-dark .inline-error{color:#ff9a90}
body.theme-dark #toast{background:#1b2a44;color:#fff;box-shadow:0 10px 30px #0008}

/* Lớp nổi: gợi ý, chọn nhanh, chuông, hồ sơ, dấu "?" */
body.theme-dark .choice-panel,body.theme-dark .suggest-panel,body.theme-dark .bell-panel,body.theme-dark .profile-panel,body.theme-dark .scope-panel,body.theme-dark .help-tip,body.theme-dark .media-viewer{background:var(--d-surface);border-color:var(--d-line);color:var(--d-ink);box-shadow:0 18px 44px #00000073}
body.theme-dark .choice-panel [data-value]:hover,body.theme-dark .suggest-panel tr:hover,body.theme-dark .bell-item:hover{background:var(--d-surface-3)}
body.theme-dark .help-tip{background:#0d1526;color:var(--d-ink)}
body.theme-dark .help-q{background:var(--d-surface-3);border-color:var(--d-line-2);color:var(--d-ink-2)}

/* Trang, thanh công cụ, danh sách */
body.theme-dark .toolbar,body.theme-dark .actions,body.theme-dark .sl-sticky,body.theme-dark .sl-bulk,body.theme-dark .settings-head,body.theme-dark .lb-bar{background:var(--d-surface);border-color:var(--d-line);color:var(--d-ink)}
body.theme-dark .sl-group,body.theme-dark .sl-group-head,body.theme-dark .folder-tile,body.theme-dark .tree-node,body.theme-dark .media-item,body.theme-dark .qm-row{background:var(--d-surface);border-color:var(--d-line);color:var(--d-ink)}
body.theme-dark .tree-node:hover,body.theme-dark .folder-tile:hover{background:var(--d-surface-3)}
body.theme-dark .tree-node.active{background:var(--d-brand-soft);color:#fff}
body.theme-dark .guide-side,body.theme-dark .guide-article{background:var(--d-surface);border-color:var(--d-line)}
body.theme-dark .guide-article .guide-toc{background:#0d1526;box-shadow:0 1px 0 var(--d-line)}
body.theme-dark #guide-list a{color:var(--d-ink-2)}
body.theme-dark #guide-list a.active{background:var(--d-brand-soft);color:#fff}
body.theme-dark .guide-body blockquote,body.theme-dark .guide-note{background:#10233f;border-color:var(--d-brand)}
body.theme-dark .guide-body code,body.theme-dark code{background:#0d1526;color:#cfe0ff}
body.theme-dark .share-item,body.theme-dark .share-mode,body.theme-dark .qd-opts,body.theme-dark .qd-mode{background:var(--d-surface-2);border-color:var(--d-line-2);color:var(--d-ink)}
body.theme-dark .share-item.current,body.theme-dark .share-mode.picked,body.theme-dark .qd-mode:has(input:checked){background:var(--d-brand-soft);border-color:var(--d-brand)}
body.theme-dark .qd-done{background:#0f2a1d;border-color:#1f5c3c}
body.theme-dark .qd-done strong{color:#8ff0bb}

/* Giữ nền sáng cho bản in và bản xem trước tài liệu */
body.theme-dark .qc-sheet,body.theme-dark #lb-page,body.theme-dark .wm-a4,body.theme-dark .lb-thumb-inner,body.theme-dark .lb-pdf-pages img{background:#fff;color:#1d283b}
body.theme-dark .preview-dialog .table-wrap{background:#fff}

/* Vài chỗ cần chỉnh tay sau khi sinh bảng màu tối */
body.theme-dark .dialog-head button,body.theme-dark [data-act=close-dialog],body.theme-dark [data-media-close]{background:var(--d-surface-2);border-color:var(--d-line-2);color:var(--d-ink-2)}
body.theme-dark .dialog-head button:hover,body.theme-dark [data-act=close-dialog]:hover{background:var(--d-surface-3);color:var(--d-ink)}
body.theme-dark .login-card,body.theme-dark .auth{background:var(--d-surface);border-color:var(--d-line);color:var(--d-ink)}
body.theme-dark .qm-status,body.theme-dark .share-chip,body.theme-dark .sl-badge{color:var(--d-ink-2)}
body.theme-dark .qm-meta,body.theme-dark .qm-company,body.theme-dark .qm-owner,body.theme-dark .sl-sub,body.theme-dark .folder-note,body.theme-dark .qm-meta *{color:var(--d-ink-3)}
body.theme-dark ::-webkit-scrollbar{width:12px;height:12px}
body.theme-dark ::-webkit-scrollbar-thumb{border:3px solid transparent;border-radius:8px;background:#2a3a55;background-clip:content-box}
body.theme-dark ::-webkit-scrollbar-track{background:#0b1220}

/* Nút chuyển sáng / tối cạnh chuông */
.theme-toggle{display:inline-grid;place-items:center;width:38px;height:38px;padding:0;border:1px solid #d7dce5;border-radius:10px;background:#fff;color:#475467}
.theme-toggle:hover{border-color:var(--brand,#0964fe);background:#f2f6ff;color:var(--brand,#0964fe)}
.theme-toggle .solid-icon{width:19px;height:19px}
body.theme-dark .theme-toggle{border-color:var(--d-line-2);background:var(--d-surface-2);color:#ffd27a}
body.theme-dark .theme-toggle:hover{background:var(--d-surface-3);border-color:#3a4c6b;color:#ffdf9e}
@media(max-width:760px){.theme-toggle{width:34px;height:34px}}
