    /* ===== المرحلة 8: الوضع الليلي ===== */
    html[data-theme="dark"] { color-scheme: dark; --primary:#aab8ff; --primary-dark:#8ea2ff; --primary-light:#1b2547; --bg:#0b1120; --card:rgba(17,26,46,.97); --text:#e5e9f2; --muted:#9aa7bd; --border:#27324d; --green:#86efac; --green-bg:#12331f; --orange:#fbbf24; --orange-bg:#3a2a08; --red:#fca5a5; --red-bg:#3b1519; --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow-md:0 8px 20px rgba(0,0,0,.45); --shadow-lg:0 20px 44px rgba(0,0,0,.6); }
    html[data-theme="dark"] body { background-color:#0b1120; background-image:linear-gradient(180deg,#0d1427 0%,#0a0f1d 100%); color:var(--text); }
    html[data-theme="dark"] body::before { filter:grayscale(1) brightness(3); opacity:.045; }
    html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background:#0e1629; color:var(--text); border-color:#2b3a5c; }
    html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color:#6f82a3; }
    html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color:#2dd4bf; }
    html[data-theme="dark"] option { background:#0e1629; color:var(--text); }
    html[data-theme="dark"] .btn-outline, html[data-theme="dark"] .expand-btn, html[data-theme="dark"] .scroll-arrow, html[data-theme="dark"] .toolbar2 select, html[data-theme="dark"] .mf-grid select { background:#17223d; color:var(--text); border:1px solid #2b3a5c; }
    html[data-theme="dark"] .btn-outline:hover, html[data-theme="dark"] .expand-btn:hover { background:#1d2b4d; border-color:#3a4d7a; }
    html[data-theme="dark"] .btn-primary, html[data-theme="dark"] .tab-btn.active { background:#3a4aa8; color:#fff; }
    html[data-theme="dark"] .btn-danger { background:#3b1519; color:#fca5a5; }
    html[data-theme="dark"] .btn-excel { background:#166534; }
    html[data-theme="dark"] header .btn-outline { background:rgba(255,255,255,.12) !important; color:#fff !important; border-color:rgba(255,255,255,.28) !important; }
    html[data-theme="dark"] .dashboard-title-bar { background:linear-gradient(90deg,#16203d 0%,#111a31 60%,#0f1729 100%); border-color:#27324d; color:#c7d2fe; }
    html[data-theme="dark"] .dashboard-title-bar span[style*='color:#64748b'], html[data-theme="dark"] #lastSyncLabel { color:#94a3b8 !important; }
    html[data-theme="dark"] .kpi, html[data-theme="dark"] .filters, html[data-theme="dark"] .insights, html[data-theme="dark"] .table-wrapper { border-color:#27324d; }
    html[data-theme="dark"] .card { border-left-color:#27324d; border-right-color:#27324d; border-bottom-color:#27324d; }
    html[data-theme="dark"] .toast { background:#243063; color:#fff; }
    html[data-theme="dark"] .kpi { border-left-color:var(--kpi,#475569); }
    html[data-theme="dark"] .kpi:hover { border-color:#27324d; border-left-color:var(--kpi,#475569); }
    html[data-theme="dark"] .kpi-section-title { color:#94a3b8; }
    html[data-theme="dark"] .k-total .val { color:#a5b4fc !important; }
    html[data-theme="dark"] .k-ok .val { color:#4ade80 !important; }
    html[data-theme="dark"] .k-warn .val { color:#fbbf24 !important; }
    html[data-theme="dark"] .k-bad .val { color:#f87171 !important; }
    html[data-theme="dark"] .k-muted .val { color:#cbd5e1 !important; }
    html[data-theme="dark"] .k-total { --kpi:#818cf8; }
    html[data-theme="dark"] .results-info, html[data-theme="dark"] .sort-label { color:#9aa7bd; }
    html[data-theme="dark"] .company-name, html[data-theme="dark"] .dup-company, html[data-theme="dark"] .q-title, html[data-theme="dark"] .export-section h4 { color:#c7d2fe; }
    html[data-theme="dark"] .info-row, html[data-theme="dark"] .dup-grid, html[data-theme="dark"] .fu-row-main, html[data-theme="dark"] .notif-body { color:#cbd5e1; }
    html[data-theme="dark"] .info-row .k, html[data-theme="dark"] .detail-label, html[data-theme="dark"] .added-by, html[data-theme="dark"] .sub-meta { color:#8b9ab3; }
    html[data-theme="dark"] .copyable { border-bottom-color:#5b6b88; }
    html[data-theme="dark"] .copyable:hover { color:#a5b4fc; }
    html[data-theme="dark"] .tag { background:#1b2547; color:#c7d2fe; }
    html[data-theme="dark"] .tag-gray { background:#1e2a45; color:#cbd5e1; }
    html[data-theme="dark"] .notes-box, html[data-theme="dark"] .tbl-notes-cell { background:#0e1629; color:#b6c2d6; }
    html[data-theme="dark"] .card-details.has-more:not(.expanded)::after { background:linear-gradient(to bottom, rgba(17,26,46,0), #111a2e 90%); }
    html[data-theme="dark"] .badge-approved { background:#12331f; color:#86efac; border-color:#1f5a35; }
    html[data-theme="dark"] .badge-conditional { background:#3a2a08; color:#fbbf24; border:1px solid #6b4a0f; }
    html[data-theme="dark"] .badge-rejected { background:#3b1519; color:#fca5a5; border:1px solid #7f2a31; }
    html[data-theme="dark"] .badge-review, html[data-theme="dark"] #saveLaterBtn, html[data-theme="dark"] .q-note { background:#3a1f0c; color:#fdba74; border-color:#7c3a14; }
    html[data-theme="dark"] .badge-fu-over { background:#3b1519; color:#fca5a5; border-color:#7f2a31; }
    html[data-theme="dark"] .badge-fu-today { background:#3a1f0c; color:#fdba74; border-color:#7c3a14; }
    html[data-theme="dark"] .badge-fu-soon { background:#14284f; color:#93c5fd; border-color:#2a4a85; }
    html[data-theme="dark"] .badge-fu-later { background:#1e2a45; color:#cbd5e1; border-color:#2b3a5c; }
    html[data-theme="dark"] .btn-reviewed { background:#0f2e24; color:#6ee7b7; border:1px solid #1f6f55; }
    html[data-theme="dark"] .btn.active-filter { background:#3a1f0c; border-color:#fb923c; color:#fdba74; }
    html[data-theme="dark"] .card.flash, html[data-theme="dark"] tr.flash td { background-color:#10302e; }
    html[data-theme="dark"] .table-scroll-controls { background:#162038; }
    html[data-theme="dark"] .table-top-scroll, html[data-theme="dark"] .table-top-scroll::-webkit-scrollbar-track, html[data-theme="dark"] .table-scroll-container::-webkit-scrollbar-track { background:#1a2440; }
    html[data-theme="dark"] .table-top-scroll::-webkit-scrollbar-thumb, html[data-theme="dark"] .table-scroll-container::-webkit-scrollbar-thumb { background:#475a8a; border-color:#1a2440; }
    html[data-theme="dark"] .vendors-table th { background:#162038; color:#c7d2fe; border-bottom-color:#2b3a5c; }
    html[data-theme="dark"] .vendors-table th:first-child { background:#1a2750; }
    html[data-theme="dark"] .vendors-table th, html[data-theme="dark"] .vendors-table td { border-right-color:#1a2440; border-bottom-color:#27324d; }
    html[data-theme="dark"] .vendors-table td:first-child, html[data-theme="dark"] .vendors-table tbody tr:nth-child(even) td:first-child { background:#111a2e; }
    html[data-theme="dark"] .vendors-table tbody tr:nth-child(even) td { background:#0f1729; }
    html[data-theme="dark"] .vendors-table tr:hover td, html[data-theme="dark"] .vendors-table tr:hover td:first-child { background:#17223d; }
    html[data-theme="dark"] .vendors-table td { color:#d5dcea; }
    html[data-theme="dark"] .table-avatar { background:#1b2547; color:#c7d2fe; border-color:#2b3a5c; }
    html[data-theme="dark"] .modal-backdrop { background:rgba(2,6,18,.78); }
    html[data-theme="dark"] .modal, html[data-theme="dark"] .login-card { background:#111a2e; color:var(--text); }
    html[data-theme="dark"] .modal h3, html[data-theme="dark"] .login-card h2, html[data-theme="dark"] .login-card h3 { color:#c7d2fe !important; }
    html[data-theme="dark"] .form-group label, html[data-theme="dark"] .checkbox-group label { color:#b6c2d6; }
    html[data-theme="dark"] .scan-box { background:linear-gradient(180deg,#0f2a2c,#0e2230); border-color:#14b8a6; }
    html[data-theme="dark"] .scan-box div[style*='color:#0f766e'], html[data-theme="dark"] .scan-status { color:#5eead4 !important; }
    html[data-theme="dark"] .drive-badge { background:#14284f; color:#93c5fd; }
    html[data-theme="dark"] .preview-item, html[data-theme="dark"] .q-item { background:#0e1629; border-color:#2b3a5c; }
    html[data-theme="dark"] .checkbox-group, html[data-theme="dark"] .export-section, html[data-theme="dark"] .more-filters { background:#0e1629; border-color:#27324d; }
    html[data-theme="dark"] .users-table th, html[data-theme="dark"] .tab-btn { background:#162038; color:#c7d2fe; }
    html[data-theme="dark"] .users-table th, html[data-theme="dark"] .users-table td, html[data-theme="dark"] .tab-bar { border-color:#27324d; }
    html[data-theme="dark"] .users-table small { color:#94a3b8 !important; }
    html[data-theme="dark"] .loader { color:#94a3b8; }
    html[data-theme="dark"] .loader::before { border-color:#27324d; border-top-color:#14b8a6; }
    html[data-theme="dark"] .login-card p, html[data-theme="dark"] .q-help, html[data-theme="dark"] .q-meta { color:#94a3b8; }
    html[data-theme="dark"] .login-logo { background:#fff; padding:8px 16px; border-radius:12px; box-sizing:content-box; height:58px; }
    html[data-theme="dark"] .login-err { color:#fca5a5; }
    html[data-theme="dark"] .login-ok, html[data-theme="dark"] .q-empty { color:#86efac; }
    html[data-theme="dark"] .login-card a, html[data-theme="dark"] .login-card label { color:#a5b4fc; }
    html[data-theme="dark"] .dup-warning { background:#2a1215; border-color:#7f2a31; border-left-color:#ef4444; }
    html[data-theme="dark"] .dup-title, html[data-theme="dark"] .dup-row { color:#fca5a5; }
    html[data-theme="dark"] .dup-row { background:#3b1519; }
    html[data-theme="dark"] .dup-sub { color:#fecaca; }
    html[data-theme="dark"] .dup-item { background:#111a2e; border-color:#7f2a31; }
    html[data-theme="dark"] .dup-chip { background:#3a2a08; color:#fbbf24; border-color:#6b4a0f; }
    html[data-theme="dark"] .dup-grid b, html[data-theme="dark"] .dup-help { color:#94a3b8; }
    html[data-theme="dark"] .notif-panel { background:#111a2e; color:var(--text); border-color:#27324d; }
    html[data-theme="dark"] .notif-head { color:#c7d2fe; border-color:#27324d; }
    html[data-theme="dark"] .notif-head button { color:#93c5fd; }
    html[data-theme="dark"] .notif-item { border-bottom-color:#1a2440; }
    html[data-theme="dark"] .notif-item:hover { background:#17223d; }
    html[data-theme="dark"] .notif-item.unread { background:#14284f; }
    html[data-theme="dark"] .notif-time, html[data-theme="dark"] .notif-empty { color:#94a3b8; }
    html[data-theme="dark"] .quick-toggle { background:#3a2a08; color:#fbbf24; border-color:#6b4a0f; }
    html[data-theme="dark"] .quick-toggle.on { background:#f59e0b; color:#1f2937; border-color:#f59e0b; }
    html[data-theme="dark"] .quick-digest-bar { background:#2a2108; color:#fbbf24; border-color:#6b4a0f; }
    html[data-theme="dark"] .form-group.ai-filled input, html[data-theme="dark"] .form-group.ai-filled select, html[data-theme="dark"] .form-group.ai-filled textarea, html[data-theme="dark"] .form-group.ai-filled .checkbox-group { background:#1d1a3b; border-color:#7c6bd6; box-shadow:0 0 0 2px rgba(124,107,214,.22); }
    html[data-theme="dark"] .form-group.ai-filled > label:first-child::after { background:#2b2557; color:#c4b5fd; }
    html[data-theme="dark"] .ai-legend { background:#1d1a3b; border-color:#4a3f8f; color:#c4b5fd; }
    html[data-theme="dark"] .review-toggle label { background:#3a1f0c; border-color:#7c3a14; color:#fdba74; }
    html[data-theme="dark"] .q-thumb { background:#17223d; }
    html[data-theme="dark"] .q-wait { background:#14284f; color:#93c5fd; }
    html[data-theme="dark"] .q-busy { background:#2b2557; color:#c4b5fd; }
    html[data-theme="dark"] .q-warn { background:#3a2a08; color:#fbbf24; }
    html[data-theme="dark"] .q-bad { background:#3b1519; color:#fca5a5; }
    html[data-theme="dark"] .q-del { color:#fca5a5; }
    html[data-theme="dark"] .ins-card { background:#0e1629; border-color:#27324d; }
    html[data-theme="dark"] .ins-track { background:#1e2a45; }
    html[data-theme="dark"] .ins-label, html[data-theme="dark"] .ins-leg { color:#d5dcea; }
    html[data-theme="dark"] .ins-total { fill:#c7d2fe; }
    html[data-theme="dark"] .fu-banner { background:#2a2108; border-color:#6b4a0f; }
    html[data-theme="dark"] .fu-banner-title { color:#fbbf24; }
    html[data-theme="dark"] .fu-chip, html[data-theme="dark"] .fu-chips button { background:#17223d; color:#cbd5e1; border-color:#2b3a5c; }
    html[data-theme="dark"] .fu-chip.over { color:#fca5a5; border-color:#7f2a31; background:#3b1519; }
    html[data-theme="dark"] .fu-chip.today { color:#fdba74; border-color:#7c3a14; background:#3a1f0c; }
    html[data-theme="dark"] .fu-chip.soon { color:#93c5fd; border-color:#2a4a85; background:#14284f; }
    html[data-theme="dark"] .fu-chip.active { outline-color:#5eead4; }
    html[data-theme="dark"] .fu-row { background:#0e1629; border-color:#27324d; }
    html[data-theme="dark"] .fu-row.fu-over { background:#2a1215; border-color:#7f2a31; }
    html[data-theme="dark"] .fu-row.fu-today { background:#2c1a0b; border-color:#7c3a14; }
    html[data-theme="dark"] .fu-row.fu-soon { background:#10203f; border-color:#2a4a85; }
    html[data-theme="dark"] .fu-when strong { color:#f1f5f9; }
    html[data-theme="dark"] .fu-note { color:#b6c2d6; }
    html[data-theme="dark"] .fu-owner { color:#94a3b8; }
    html[data-theme="dark"] .fu-box { background:#2a2108; border-color:#6b4a0f; }
    html[data-theme="dark"] .fu-box-title, html[data-theme="dark"] .fu-meta { color:#fbbf24; }
    html[data-theme="dark"] .fu-chips button:hover { background:#3a2a08; }

html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .info-row > span:not(.k), html[dir="rtl"] .copyable { unicode-bidi: plaintext; }
html[lang="ar"] * { font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif; }
html[lang="ar"] #tableWrapper, html[lang="ar"] #tableWrapper * { font-family: "Times New Roman", Times, serif !important; }
html[dir="rtl"] #tableWrapper, html[dir="rtl"] .table-wrapper { direction: ltr; }
html[dir="rtl"] input[type="email"], html[dir="rtl"] input[type="password"], html[dir="rtl"] input[type="tel"], html[dir="rtl"] input[type="url"], html[dir="rtl"] #newPhone, html[dir="rtl"] #newWebsite, html[dir="rtl"] #newWechat, html[dir="rtl"] #loginEmail { direction: ltr; text-align: left; }
html[dir="rtl"] .form-group, html[dir="rtl"] .users-table th, html[dir="rtl"] .users-table td, html[dir="rtl"] .notif-panel { text-align: right; }
html[dir="rtl"] .notif-panel { right: auto; left: 0; }
html[dir="rtl"] .notif-badge { right: auto; left: -5px; }
html[dir="rtl"] .toast { right: auto; left: 20px; border-left: none; border-right: 4px solid #2dd4bf; }
@media (max-width: 600px) { html[dir="rtl"] .toast { left: 50%; right: auto; } html[dir="rtl"] .notif-panel { left: 8px; right: 8px; } }
html[dir="rtl"] .dashboard-title-bar { border-left-width: 1px; border-right: 5px solid #162152; }
html[dir="rtl"] .kpi { border-left: 1px solid #e6ecf5; border-right: 4px solid var(--kpi, #cbd5e1); }
html[dir="rtl"][data-theme="dark"] .kpi { border-left-color: #27324d; }
html[dir="rtl"] .kpi:hover { border-left-color: #e6ecf5; border-right-color: var(--kpi, #cbd5e1); }
html[dir="rtl"][data-theme="dark"] .kpi:hover { border-left-color: #27324d; }
html[dir="rtl"] .notes-box { border-left: none; border-right: 3px solid var(--accent); }
html[dir="rtl"] .dup-warning { border-left-width: 1px; border-right: 5px solid #dc2626; }
html[dir="rtl"] .count-pill { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .form-group.ai-filled > label:first-child::after { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .mf-actions { text-align: left; }
html[dir="rtl"] .badge-stack { align-items: flex-start; }
html[dir="rtl"] #loginPass { padding-right: 12px !important; padding-left: 38px !important; }
html[dir="rtl"] .login-card span[onclick*="togglePassVisibility"] { right: auto !important; left: 10px; }
html[dir="rtl"] .login-card .form-group { text-align: right; }
html[dir="rtl"] .expand-btn { padding: 5px 12px 5px 14px; }
html[dir="rtl"] .scroll-arrow svg { transform: scaleX(-1); }
html[dir="rtl"] .q-del { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .card-actions .btn[style*="margin-left:auto"] { margin-left: 0 !important; margin-right: auto; }

/* ===== المرحلة 8: أزرار الوضع الليلي واللغة ===== */
.hdr-tool { min-width: 38px; padding: 6px 11px !important; background: rgba(255,255,255,.14) !important; color: #fff !important; border: 1px solid rgba(255,255,255,.3) !important; border-radius: 999px !important; font-weight: 700; }
.hdr-tool:hover { background: rgba(255,255,255,.26) !important; }
.login-tools { position: absolute; top: 14px; inset-inline-end: 14px; display: flex; gap: 8px; z-index: 3; }
.login-tools .hdr-tool { padding: 7px 13px !important; font-size: 13px; }
html:not([data-theme="dark"]) .login-tools .hdr-tool { background: rgba(255,255,255,.16) !important; }
