/* ============================================================
   GLOBAL BLACK THEME
   Applied only when data-theme="black"
   Existing White Theme remains unchanged.
   ============================================================ */

html[data-theme="black"] {
    color-scheme: dark;
}

/* ============================================================
   COMMON PAGE ELEMENTS
   ============================================================ */

html[data-theme="black"] body {
    background: #111111 !important;
    color: #f2f2f2 !important;
}

html[data-theme="black"] a {
    color: #ffffff;
}

html[data-theme="black"] input,
html[data-theme="black"] select,
html[data-theme="black"] textarea {
    background: #1d1d1d !important;
    color: #f2f2f2 !important;
    border-color: #444444 !important;
}

html[data-theme="black"] input::placeholder,
html[data-theme="black"] textarea::placeholder {
    color: #999999 !important;
}

html[data-theme="black"] button {
    color: #f2f2f2;
}

/* ============================================================
   SITE LOGIN
   ============================================================ */

html[data-theme="black"] .login-container {
    background: #111111 !important;
}

html[data-theme="black"] .login-card {
    background: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #333333 !important;
}

html[data-theme="black"] .login-header h1,
html[data-theme="black"] .login-header p,
html[data-theme="black"] .input-group label {
    color: #f2f2f2 !important;
}

html[data-theme="black"] .alert-error {
    color: #ff6b6b !important;
}

/* ============================================================
   SITE HOME / NAVIGATION
   ============================================================ */

html[data-theme="black"] .navbar {
    background: #181818 !important;
    border-bottom-color: #333333 !important;
}

html[data-theme="black"] .navbar-brand,
html[data-theme="black"] .nav-item > a,
html[data-theme="black"] .nav-button {
    color: #f2f2f2 !important;
}

html[data-theme="black"] .nav-item > a:hover,
html[data-theme="black"] .nav-button:hover {
    background: #292929 !important;
}

html[data-theme="black"] .dropdown-menu {
    background: #1c1c1c !important;
    border-color: #3a3a3a !important;
}

html[data-theme="black"] .dropdown-menu a {
    color: #f2f2f2 !important;
}

html[data-theme="black"] .dropdown-menu a:hover {
    background: #2b2b2b !important;
}

html[data-theme="black"] .welcome-card {
    background: #1b1b1b !important;
    color: #f2f2f2 !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

html[data-theme="black"] .welcome-card h1,
html[data-theme="black"] .welcome-card p {
    color: #f2f2f2 !important;
}

/* ============================================================
   PHA LOGIN
   ============================================================ */

html[data-theme="black"] .login-container,
html[data-theme="black"] .login-page {
    background: #111111 !important;
}

html[data-theme="black"] .login-card,
html[data-theme="black"] .login-box {
    background: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #333333 !important;
}

/* ============================================================
   PORTFOLIO / PHA
   ============================================================ */

html[data-theme="black"] .container,
html[data-theme="black"] .card {
    background-color: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #383838 !important;
}

html[data-theme="black"] .header {
    background-color: #181818 !important;
    color: #f2f2f2 !important;
    border-color: #383838 !important;
}

html[data-theme="black"] .header h1,
html[data-theme="black"] .card-title,
html[data-theme="black"] .card-value,
html[data-theme="black"] label,
html[data-theme="black"] p,
html[data-theme="black"] h1,
html[data-theme="black"] h2,
html[data-theme="black"] h3,
html[data-theme="black"] h4,
html[data-theme="black"] h5,
html[data-theme="black"] h6 {
    color: #f2f2f2 !important;
}

html[data-theme="black"] table {
    background: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #3a3a3a !important;
}

html[data-theme="black"] th,
html[data-theme="black"] td {
    background-color: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #3a3a3a !important;
}

html[data-theme="black"] thead th {
    background-color: #252525 !important;
    color: #ffffff !important;
}

html[data-theme="black"] option {
    background: #1d1d1d !important;
    color: #f2f2f2 !important;
}

/* ============================================================
   GENERAL DARK SURFACES
   ============================================================ */

html[data-theme="black"] [class*="menu"],
html[data-theme="black"] [class*="dropdown"],
html[data-theme="black"] [class*="modal"],
html[data-theme="black"] [class*="panel"] {
    background-color: #1b1b1b !important;
    color: #f2f2f2 !important;
    border-color: #3a3a3a !important;
}

/* ============================================================
   FULL BLACK THEME OVERRIDES
   Text = white/readable
   Existing semantic colours = preserved
   White Theme = unchanged
   ============================================================ */

html[data-theme="black"] body {
    background: #000000 !important;
    color: #ffffff !important;
}

/* ---------- GLOBAL TEXT ---------- */

html[data-theme="black"] body,
html[data-theme="black"] body * {
    color: #ffffff;
}

html[data-theme="black"] h1,
html[data-theme="black"] h2,
html[data-theme="black"] h3,
html[data-theme="black"] h4,
html[data-theme="black"] h5,
html[data-theme="black"] h6,
html[data-theme="black"] p,
html[data-theme="black"] span,
html[data-theme="black"] label,
html[data-theme="black"] td,
html[data-theme="black"] th,
html[data-theme="black"] li,
html[data-theme="black"] div {
    color: #ffffff;
}

/* ---------- PRESERVE EXISTING STATUS COLOURS ---------- */

html[data-theme="black"] .pha-health-excellent,
html[data-theme="black"] .pha-health-good {
    color: #16803a !important;
}

html[data-theme="black"] .pha-health-needs-improvement {
    color: #c76b00 !important;
}

html[data-theme="black"] .pha-health-poor {
    color: #cc0000 !important;
}

html[data-theme="black"] .pha-summary-positive {
    color: #188038 !important;
}

html[data-theme="black"] .pha-summary-negative {
    color: #d00000 !important;
}

html[data-theme="black"] .pha-summary-average {
    color: #d97700 !important;
}

/* ---------- NAVIGATION ---------- */

html[data-theme="black"] .navbar {
    background: #111111 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .navbar *,
html[data-theme="black"] .nav-item,
html[data-theme="black"] .nav-button,
html[data-theme="black"] .navbar a {
    color: #ffffff !important;
}

html[data-theme="black"] .dropdown-menu {
    background: #181818 !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .dropdown-menu a {
    color: #ffffff !important;
}

html[data-theme="black"] .dropdown-menu a:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* ---------- CARDS / PANELS ---------- */

html[data-theme="black"] .container,
html[data-theme="black"] .card,
html[data-theme="black"] .pha-health-card,
html[data-theme="black"] .pha-alerts-card,
html[data-theme="black"] .panel,
html[data-theme="black"] .section,
html[data-theme="black"] .welcome-card {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #444444 !important;
}

/* ---------- INPUTS ---------- */

html[data-theme="black"] input,
html[data-theme="black"] textarea,
html[data-theme="black"] select {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] input::placeholder,
html[data-theme="black"] textarea::placeholder {
    color: #bbbbbb !important;
}

html[data-theme="black"] select option {
    background: #181818 !important;
    color: #ffffff !important;
}

/* ---------- TABLES ---------- */

html[data-theme="black"] table,
html[data-theme="black"] .benchmark-table,
html[data-theme="black"] .sector-benchmark-table {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] table th,
html[data-theme="black"] table td {
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] table th {
    background: #222222 !important;
}

html[data-theme="black"] table tbody tr:hover {
    background: #2a2a2a !important;
}

/* ---------- PHA CONFIGURATION ---------- */

html[data-theme="black"] .pha-config-input,
html[data-theme="black"] .pha-config-row,
html[data-theme="black"] .pha-config-save {
    color: #ffffff !important;
}

html[data-theme="black"] .pha-config-row select,
html[data-theme="black"] .pha-config-row input {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .pha-config-row select option {
    background: #181818 !important;
    color: #ffffff !important;
}

/* ---------- HEALTH SUMMARY ---------- */

html[data-theme="black"] .pha-score-health > span,
html[data-theme="black"] .pha-summary-grid span,
html[data-theme="black"] .pha-summary-light,
html[data-theme="black"] .pha-missing-line,
html[data-theme="black"] .pha-risk-row span,
html[data-theme="black"] .pha-risk-row strong,
html[data-theme="black"] .pha-risk-row b {
    color: #ffffff !important;
}

html[data-theme="black"] .pha-summary-divider {
    background: #555555 !important;
}

html[data-theme="black"] .pha-risk-row {
    border-color: #444444 !important;
}

/* ---------- ALERTS ---------- */

html[data-theme="black"] .pha-alerts-card {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .pha-alert {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .pha-alert * {
    color: #ffffff !important;
}

/* ---------- BENCHMARK / ANALYSIS ---------- */

html[data-theme="black"] .benchmark-title,
html[data-theme="black"] .benchmark-result,
html[data-theme="black"] .benchmark-source,
html[data-theme="black"] .sector-benchmark-title,
html[data-theme="black"] .pha-section-heading,
html[data-theme="black"] .pha-health-analyzer {
    color: #ffffff !important;
}

html[data-theme="black"] .benchmark-select,
html[data-theme="black"] .benchmark-table,
html[data-theme="black"] .benchmark-model-row,
html[data-theme="black"] .benchmark-chart-container,
html[data-theme="black"] .benchmark-pie,
html[data-theme="black"] .sector-benchmark-table,
html[data-theme="black"] .sector-benchmark-model-row {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .benchmark-select {
    background: #181818 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .benchmark-model-row,
html[data-theme="black"] .sector-benchmark-model-row {
    background: #222222 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .benchmark-table th,
html[data-theme="black"] .sector-benchmark-table th {
    background: #222222 !important;
    color: #ffffff !important;
}

/* ---------- BUTTON TEXT ---------- */

html[data-theme="black"] button {
    color: #ffffff;
}

html[data-theme="black"] button *,
html[data-theme="black"] .validate-button *,
html[data-theme="black"] .pha-config-save button * {
    color: #ffffff !important;
}

/* ---------- LINKS ---------- */

html[data-theme="black"] a {
    color: #ffffff;
}

html[data-theme="black"] a:hover {
    color: #ffffff;
}

/* ---------- FOOTER ---------- */

html[data-theme="black"] .footer,
html[data-theme="black"] .footer * {
    color: #ffffff !important;
}

/* ---------- COMMON LIGHT SURFACES ---------- */

html[data-theme="black"] [style*="background: white"],
html[data-theme="black"] [style*="background:white"],
html[data-theme="black"] [style*="background: #fff"],
html[data-theme="black"] [style*="background:#fff"],
html[data-theme="black"] [style*="background: #ffffff"],
html[data-theme="black"] [style*="background:#ffffff"] {
    background: #111111 !important;
}

/* ---------- CHART / CANVAS SURROUNDINGS ---------- */

html[data-theme="black"] .chart-container,
html[data-theme="black"] .chart-card,
html[data-theme="black"] .benchmark-chart-container {
    background: #111111 !important;
    color: #ffffff !important;
}

/* ---------- MODALS / MENUS / PANELS ---------- */

html[data-theme="black"] .modal,
html[data-theme="black"] .modal-content,
html[data-theme="black"] .menu,
html[data-theme="black"] .panel,
html[data-theme="black"] [class*="dropdown"],
html[data-theme="black"] [class*="modal"] {
    color: #ffffff !important;
}

html[data-theme="black"] .modal-content {
    background: #111111 !important;
    border-color: #444444 !important;
}

/* ---------- LOGIN / ERROR MESSAGES ---------- */

html[data-theme="black"] .alert-error {
    color: #ffffff !important;
}


/* ============================================================
   BLACK THEME - PAGE SURFACE OVERRIDES
   Existing element/semantic colours are preserved.
   ============================================================ */

/* ============================================================
   SITE LOGIN
   ============================================================ */

html[data-theme="black"] body:has(.login-card) {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .login-card {
    background: #111111 !important;
    border-color: #444444 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .login-header h1,
html[data-theme="black"] .login-header p,
html[data-theme="black"] .input-group label {
    color: #ffffff !important;
}

html[data-theme="black"] .input-group input {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .input-group input::placeholder {
    color: #bbbbbb !important;
}

/* Preserve existing error colour */
html[data-theme="black"] .alert-error {
    color: #b42318 !important;
}

/* ============================================================
   HOME / INDEX
   ============================================================ */

html[data-theme="black"] body:has(.navbar) {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .navbar {
    background: #111111 !important;
    border-bottom-color: #444444 !important;
}

html[data-theme="black"] .navbar-brand,
html[data-theme="black"] .nav-item > a,
html[data-theme="black"] .nav-button {
    color: #ffffff !important;
}

html[data-theme="black"] .nav-item > a:hover,
html[data-theme="black"] .nav-button:hover {
    background: #222222 !important;
}

html[data-theme="black"] .dropdown-menu {
    background: #181818 !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .dropdown-menu a {
    color: #ffffff !important;
}

html[data-theme="black"] .dropdown-menu a:hover {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

html[data-theme="black"] .welcome-card {
    background: #111111 !important;
    color: #ffffff !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .welcome-card h1,
html[data-theme="black"] .welcome-card p {
    color: #ffffff !important;
}

/* ============================================================
   BROKERAGE / PHA LOGIN
   ============================================================ */

html[data-theme="black"] body:has(.login-shell) {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .login-shell {
    background: #111111 !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .welcome-panel {
    background: #111111 !important;
    border-right-color: #444444 !important;
}

html[data-theme="black"] .form-panel {
    background: #111111 !important;
}

html[data-theme="black"] .brand-mark {
    background: #181818 !important;
}

html[data-theme="black"] .brand-mark span {
    color: #ffffff !important;
}

html[data-theme="black"] .brand-name,
html[data-theme="black"] .welcome-content,
html[data-theme="black"] .form-container {
    color: #ffffff !important;
}

html[data-theme="black"] .form-container label,
html[data-theme="black"] .form-container h1,
html[data-theme="black"] .form-container h2,
html[data-theme="black"] .form-container h3,
html[data-theme="black"] .form-container p {
    color: #ffffff !important;
}

html[data-theme="black"] .login-shell input {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .login-shell input::placeholder {
    color: #bbbbbb !important;
}

/* Preserve existing invalid/error colours */
html[data-theme="black"] .login-shell input.invalid {
    background: #fffafb !important;
}

/* ============================================================
   PHA / PORTFOLIO - MAIN SURFACES
   ============================================================ */

html[data-theme="black"] .pha-health-card,
html[data-theme="black"] .pha-alerts-card,
html[data-theme="black"] .pha-email-card,
html[data-theme="black"] .pha-whatsapp-card {
    background: #111111 !important;
    border-color: #444444 !important;
}

/* Additional portfolio cards/panels */
html[data-theme="black"] .pha-health-analyzer,
html[data-theme="black"] .pha-section,
html[data-theme="black"] .pha-panel,
html[data-theme="black"] .pha-card {
    background: #111111 !important;
    color: #ffffff !important;
}

/* ============================================================
   EMAIL
   ============================================================ */

html[data-theme="black"] .pha-email-header h3,
html[data-theme="black"] .pha-email-header p,
html[data-theme="black"] .pha-email-form label {
    color: #ffffff !important;
}

html[data-theme="black"] #phaEmailAddress {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] #phaEmailAddress::placeholder {
    color: #bbbbbb !important;
}

/* Keep existing button colour */
html[data-theme="black"] #phaSendEmail {
    color: #ffffff !important;
}

/* ============================================================
   WHATSAPP PRICE ALERTS
   ============================================================ */

html[data-theme="black"] .pha-whatsapp-header h3,
html[data-theme="black"] .pha-whatsapp-header p,
html[data-theme="black"] .pha-whatsapp-field label,
html[data-theme="black"] .pha-whatsapp-field small {
    color: #ffffff !important;
}

html[data-theme="black"] .pha-whatsapp-field input,
html[data-theme="black"] .pha-whatsapp-field select {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .pha-whatsapp-field input::placeholder {
    color: #bbbbbb !important;
}

html[data-theme="black"] .pha-whatsapp-field select option {
    background: #181818 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .pha-whatsapp-alert-actions button {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .pha-whatsapp-alert-actions button:hover {
    background: #2a2a2a !important;
}

/* Preserve danger colour */
html[data-theme="black"] .pha-whatsapp-alert-actions button.danger {
    color: #b42318 !important;
}

/* ============================================================
   BENCHMARK DROPDOWNS / OPTIONS
   ============================================================ */

html[data-theme="black"] .benchmark-select,
html[data-theme="black"] .pha-config-row select {
    background: #181818 !important;
    color: #ffffff !important;
    border-color: #555555 !important;
}

html[data-theme="black"] .benchmark-select option,
html[data-theme="black"] .benchmark-select option:checked,
html[data-theme="black"] .pha-config-row select option {
    background: #181818 !important;
    color: #ffffff !important;
}

/* ============================================================
   WHITE SURFACE ELIMINATION
   ============================================================ */

html[data-theme="black"] .eee-section {
    background: #111111 !important;
    border-color: #444444 !important;
}

html[data-theme="black"] .pha-email-card *,
html[data-theme="black"] .pha-whatsapp-card *,
html[data-theme="black"] .pha-health-card *,
html[data-theme="black"] .pha-alerts-card * {
    color: #ffffff;
}

/* Re-apply semantic colours after the card text rule */
html[data-theme="black"] .pha-health-excellent,
html[data-theme="black"] .pha-health-good {
    color: #16803a !important;
}

html[data-theme="black"] .pha-health-needs-improvement {
    color: #c76b00 !important;
}

html[data-theme="black"] .pha-health-poor {
    color: #cc0000 !important;
}

html[data-theme="black"] .pha-summary-positive {
    color: #188038 !important;
}

html[data-theme="black"] .pha-summary-negative {
    color: #d00000 !important;
}

html[data-theme="black"] .pha-summary-average {
    color: #d97700 !important;
}


/* ============================================================
   BLACK THEME - PHA LOGIN SECURE ACCESS CARD
   Existing text/icon colours preserved.
   ============================================================ */

html[data-theme="black"] .secure-card {
    background: #181818 !important;
    border-color: #444444 !important;
}


/* Preserve original Secure Access icon colours in Black Theme */
html[data-theme="black"] .secure-icon {
    color: #155bc9 !important;
    background: #e3edff !important;
}


/* FINAL: restore original Secure Access icon colour */
html[data-theme="black"] .secure-card .secure-icon {
    color: #155bc9 !important;
    background: #e3edff !important;
}

html[data-theme="black"] .secure-card .secure-icon svg {
    color: #155bc9 !important;
    stroke: #155bc9 !important;
}


/* ============================================================
   BLACK THEME - PRESERVE ORIGINAL LOGIN ERROR COLOURS
   ============================================================ */

html[data-theme="black"] .server-error {
    color: var(--danger) !important;
}

html[data-theme="black"] .server-error * {
    color: inherit !important;
}


/* Black Theme - dark error notification background */
html[data-theme="black"] .server-error {
    background: #111111 !important;
}


/* ============================================================
   BLACK THEME - INVALID REQUIRED INPUTS
   Preserve original red validation styling.
   ============================================================ */

html[data-theme="black"] .login-shell input.invalid {
    background: #181818 !important;
    border-color: #d85a61 !important;
    box-shadow: 0 0 0 3px rgba(216, 90, 97, 0.07) !important;
}

html[data-theme="black"] .field-error.visible {
    color: var(--danger) !important;
}


/* Black Theme - Portfolio live price subtitle */
html[data-theme="black"] .subtitle {
    color: #ffffff !important;
}

html[data-theme="black"] #asOnDateTime {
    color: #ffffff !important;
}


/* ============================================================
   BLACK THEME - BENCHMARK / VALIDATION TEXT
   Normal text becomes white.
   Existing semantic colours remain unchanged.
   ============================================================ */

html[data-theme="black"] .benchmark-select {
    color: #ffffff !important;
    background: #181818 !important;
}

html[data-theme="black"] .benchmark-select option {
    color: #ffffff !important;
    background: #181818 !important;
}

/* Benchmark model labels */
html[data-theme="black"] .benchmark-model-row,
html[data-theme="black"] .sector-benchmark-model-row,
html[data-theme="black"] .benchmark-model-name {
    color: #ffffff !important;
    background: #222222 !important;
}

/* Benchmark table normal text */
html[data-theme="black"] .benchmark-table th,
html[data-theme="black"] .benchmark-table td,
html[data-theme="black"] .sector-benchmark-table th,
html[data-theme="black"] .sector-benchmark-table td {
    color: #ffffff !important;
}

/* Preserve benchmark remark colours */
html[data-theme="black"] .benchmark-difference-equal,
html[data-theme="black"] .sector-difference-equal {
    color: #008000 !important;
}

html[data-theme="black"] .benchmark-difference-excess,
html[data-theme="black"] .sector-difference-excess {
    color: #cc0000 !important;
}

html[data-theme="black"] .benchmark-difference-less,
html[data-theme="black"] .sector-difference-less {
    color: #b45f00 !important;
}

/* Email normal text */
html[data-theme="black"] .pha-email-header h3,
html[data-theme="black"] .pha-email-header p,
html[data-theme="black"] .pha-email-form label {
    color: #ffffff !important;
}

html[data-theme="black"] #phaEmailAddress {
    color: #ffffff !important;
    background: #181818 !important;
}

/* WhatsApp normal text */
html[data-theme="black"] .pha-whatsapp-header h3,
html[data-theme="black"] .pha-whatsapp-header p,
html[data-theme="black"] .pha-whatsapp-field label,
html[data-theme="black"] .pha-whatsapp-field small {
    color: #ffffff !important;
}

html[data-theme="black"] .pha-whatsapp-field input,
html[data-theme="black"] .pha-whatsapp-field select {
    color: #ffffff !important;
    background: #181818 !important;
}

html[data-theme="black"] .pha-whatsapp-field input::placeholder {
    color: #bbbbbb !important;
}

html[data-theme="black"] .pha-whatsapp-field select option {
    color: #ffffff !important;
    background: #181818 !important;
}

/* WhatsApp status text */
html[data-theme="black"] .pha-whatsapp-alert-status {
    color: #ffffff !important;
    background: #222222 !important;
}


/* BLACK THEME - ALLOCATION DONUT CENTRE */
html[data-theme="black"] .pie-chart::after {
    background: #000000 !important;
}

/* BLACK THEME - ALLOCATION LEGEND TEXT */
html[data-theme="black"] .chart-legend .legend-name,
html[data-theme="black"] .chart-legend .chart-legend-name,
html[data-theme="black"] .chart-legend .legend-value,
html[data-theme="black"] .chart-legend .chart-legend-value {
    color: #ffffff !important;
}


/* BLACK THEME - PORTFOLIO HEALTH DASHBOARD */
html[data-theme="black"] .pha-dashboard-card {
    background: #111111 !important;
    border-color: #444444 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .pha-dashboard-card h3,
html[data-theme="black"] .pha-dashboard-card h4,
html[data-theme="black"] .pha-dashboard-card p,
html[data-theme="black"] .pha-dashboard-card span,
html[data-theme="black"] .pha-dashboard-card label {
    color: #ffffff !important;
}


/* BLACK THEME - MATCH PORTFOLIO HEADER BLUE */
html[data-theme="black"] #phaSendEmail {
    background: #1f3a5f !important;
    color: #ffffff !important;
}

html[data-theme="black"] #phaSendEmail:hover {
    background: #1f3a5f !important;
    color: #ffffff !important;
}


/* BLACK THEME - DARK BLUE EMAIL BUTTON */
html[data-theme="black"] #phaSendEmail {
    background: #163a63 !important;
    color: #ffffff !important;
}

html[data-theme="black"] #phaSendEmail:hover {
    background: #163a63 !important;
}


/* BLACK THEME - CLEAR DARK BLUE EMAIL BUTTON */
html[data-theme="black"] #phaSendEmail {
    background: #004a99 !important;
    color: #ffffff !important;
}

html[data-theme="black"] #phaSendEmail:hover {
    background: #004a99 !important;
}


/* BLACK THEME - MATCH ADD PRICE ALERT WITH EMAIL BUTTON */
html[data-theme="black"] #phaAddWhatsAppAlert {
    background: #004A99 !important;
    color: #ffffff !important;
    border-color: #004A99 !important;
}

html[data-theme="black"] #phaAddWhatsAppAlert:hover {
    background: #004A99 !important;
    color: #ffffff !important;
    border-color: #004A99 !important;
}


/* BLACK THEME - SEND PDF ANALYSIS DARK BLUE */
html[data-theme="black"] #phaSendEmail {
    background: #004A99 !important;
    color: #ffffff !important;
}

html[data-theme="black"] #phaSendEmail:hover {
    background: #004A99 !important;
}


/* BLACK THEME - WHATSAPP ALERT FORM ALIGNMENT */
html[data-theme="black"] .pha-whatsapp-form {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: end !important;
}


/* Black Theme - WhatsApp Price Alert field alignment */
html[data-theme="black"] .pha-whatsapp-form {
    grid-template-columns: 1.25fr 1fr 1fr 1fr !important;
    align-items: end !important;
}

html[data-theme="black"] #phaAddWhatsAppAlert {
    grid-column: 4 !important;
    justify-self: end !important;
    margin-top: 2px !important;
}


/* Black Theme - Align WhatsApp alert fields from the top */
html[data-theme="black"] .pha-whatsapp-form {
    grid-template-columns: 1.25fr 1.25fr 1.25fr 1.25fr !important;
    align-items: start !important;
}

html[data-theme="black"] #phaAddWhatsAppAlert {
    grid-column: 4 !important;
    justify-self: end !important;
    margin-top: 2px !important;
}


/* Black Theme - Position Last Update at bottom-right */
html[data-theme="black"] .footer {
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: right !important;
    margin-top: 20px !important;
    padding-right: 12px !important;
}

.portfolio-management-link{display:inline-block;padding:12px 24px;background:#004A99;color:#fff;border:1px solid #004A99;border-radius:6px;font-weight:600;text-decoration:none;cursor:pointer}

/* =====================================================
   MARKET NEWS — BLACK THEME
   Scoped only to the Market News page
   ===================================================== */

html[data-theme="black"] body:has(.news-container) {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .news-container {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-theme="black"] .news-header,
html[data-theme="black"] .news-header h1,
html[data-theme="black"] .news-header p {
    color: #ffffff !important;
}

html[data-theme="black"] .news-status {
    color: #cccccc !important;
}

html[data-theme="black"] .news-card,
html[data-theme="black"] .news-empty {
    background: #111111 !important;
    color: #ffffff !important;
    border: 1px solid #444444 !important;
}

html[data-theme="black"] .news-card * {
    color: #ffffff !important;
}

html[data-theme="black"] .news-card a {
    color: #66baff !important;
}

html[data-theme="black"] .news-card a:hover {
    color: #9bd2ff !important;
}

html[data-theme="black"] .news-controls button {
    background: #181818 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}

html[data-theme="black"] .news-controls button.active {
    background: #263d5c !important;
    color: #ffffff !important;
    border-color: #66baff !important;
}

html[data-theme="black"] .news-symbols span {
    background: #252525 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}

html[data-theme="black"] .news-header > a {
    background: #181818 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}