/* BINWORKS dark UI and display-only reading colors. Compose content stays unchanged. */
html[data-bw-theme="dark"] {
  color-scheme: dark;
  --bw-bg:#17181c; --bw-surface:#202126; --bw-search:#292a31;
  --bw-text:#ececf0; --bw-muted:#b0b0bc; --bw-border:#3a3b45;
  --bw-brand:#ef75af; --bw-brand-hover:#f697c2; --bw-brand-ink:#ffb4d5;
  --bw-brand-soft:#3c2433; --bw-brand-selected:#512c40; --bw-brand-line:#78435e;
  --bw-blue:var(--bw-brand); --bw-folder:var(--bw-brand-soft); --bw-selected:var(--bw-brand-selected);
}
[data-bw-theme="dark"] .bw-ci-brand img,
[data-bw-theme="dark"] .bw-mail.task-login #logo { filter:brightness(0) invert(1); }
[data-bw-theme="dark"] .bw-mail,
[data-bw-theme="dark"] .bw-shell #layout { background:var(--bw-bg); color:var(--bw-text); }
[data-bw-theme="dark"] #bw-header,
[data-bw-theme="dark"] .bw-shell #layout-menu,
[data-bw-theme="dark"] .bw-shell #layout-sidebar { background:var(--bw-bg); border-color:var(--bw-border); }
[data-bw-theme="dark"] :is(#bw-quick,#bw-account,#bw-composer),
[data-bw-theme="dark"] .bw-shell :is(#layout-list,#layout-content),
[data-bw-theme="dark"] .bw-mail :is(.ui-dialog,.ui-dialog-content,.popupmenu,.popover),
[data-bw-theme="dark"] .bw-shell :is(#layout-list,#layout-content)>.header,
[data-bw-theme="dark"] .bw-shell .pagenav,
[data-bw-theme="dark"] .bw-compose-head { background:var(--bw-surface); color:var(--bw-text); border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-mail .ui-dialog .ui-dialog-titlebar,
[data-bw-theme="dark"] #bw-search-slot :is(.searchbar,.bw-search-home) { background:var(--bw-search); color:var(--bw-text); border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-icon,
[data-bw-theme="dark"] .bw-shell :is(.toolbar a,.bw-native-icon),
[data-bw-theme="dark"] .bw-shell #mailboxlist li>a,
[data-bw-theme="dark"] .bw-shell #taskmenu>a,
[data-bw-theme="dark"] .bw-shell #taskmenu .special-buttons>a,
[data-bw-theme="dark"] .bw-office-filter,
[data-bw-theme="dark"] .bw-mail :is(.menu.listing a,.listing li a),
[data-bw-theme="dark"] :is(#bw-account,#bw-quick) a { color:var(--bw-text); }
[data-bw-theme="dark"] .bw-mail :is(.btn-secondary,.bw-settings-link),
[data-bw-theme="dark"] .bw-shell #messagelist-header .toolbar a,
[data-bw-theme="dark"] .bw-shell #messagelist-header>.refresh,
[data-bw-theme="dark"] .bw-shell #bw-bulk-tools .bw-native-icon { background:var(--bw-search); color:var(--bw-text); border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-shell #messagelist tr.message { background:var(--bw-surface); box-shadow:inset 0 -1px 0 #303138; }
[data-bw-theme="dark"] .bw-shell #messagelist tr:hover,
[data-bw-theme="dark"] .bw-row-actions { background:#2c2931; }
[data-bw-theme="dark"] .bw-shell #messagelist tr.selected { background:var(--bw-brand-selected); }
[data-bw-theme="dark"] .bw-mail .listing tr.selected td,
[data-bw-theme="dark"] .bw-shell #mailboxlist li.selected>a,
[data-bw-theme="dark"] .bw-shell #taskmenu .selected { background:var(--bw-brand-soft); color:var(--bw-brand-ink); }
[data-bw-theme="dark"] :is(.bw-office-count,.bw-office-folder-title,.bw-office-shortcuts h2,.bw-snippet,.bw-help),
[data-bw-theme="dark"] .bw-shell #messagelist :is(td.date,td.attachment),
[data-bw-theme="dark"] .bw-mail.action-compose #compose-headers .col-form-label { color:var(--bw-muted); }
[data-bw-theme="dark"] .bw-mail :is(.form-control,.custom-select,.recipient-input),
[data-bw-theme="dark"] #bw-search-slot input,
[data-bw-theme="dark"] .bw-mail.action-compose #compose-headers :is(.form-control,.recipient-input) { background:var(--bw-search); color:var(--bw-text); border-color:var(--bw-border); }
/* Elastic recipient chips have their own light background; cover To/Cc/Bcc and drag helpers. */
[data-bw-theme="dark"] .bw-mail .recipient-input li.recipient,
[data-bw-theme="dark"] body.bw-mail>li.recipient.ui-sortable-helper {
  background:var(--bw-bg); color:var(--bw-text); border-color:var(--bw-border);
}
[data-bw-theme="dark"] .bw-mail .recipient-input li.recipient:hover {
  background:var(--bw-brand-soft); border-color:var(--bw-brand-line);
}
[data-bw-theme="dark"] .bw-mail .recipient-input li.recipient :is(.name,.email),
[data-bw-theme="dark"] body.bw-mail>li.recipient.ui-sortable-helper :is(.name,.email) { color:inherit; }
[data-bw-theme="dark"] .bw-mail .recipient-input li.recipient a.button.icon,
[data-bw-theme="dark"] body.bw-mail>li.recipient.ui-sortable-helper a.button.icon { color:var(--bw-muted); }
[data-bw-theme="dark"] .bw-mail .recipient-input li.recipient a.button.icon:hover { color:var(--bw-brand-ink); }
[data-bw-theme="dark"] .bw-mail .recipient-input input { color:var(--bw-text); caret-color:var(--bw-text); }
[data-bw-theme="dark"] .bw-mail :is(#attachment-list,.attachmentslist li),
[data-bw-theme="dark"] .bw-mail.action-compose #compose-attachments { background:var(--bw-search); color:var(--bw-text); border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-mail.action-compose :is(.formbuttons,.bw-compose-tools a,#compose_to .input-group-append a) { color:var(--bw-text); border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-shell #layout-menu>.action-buttons a.compose,
[data-bw-theme="dark"] .bw-mail .btn-primary,
[data-bw-theme="dark"] .bw-mail.action-compose .formbuttons .send { background:#be1768; border-color:#be1768; color:#fff; }
/* The authored message remains a white document, independent from surrounding UI. */
[data-bw-theme="dark"] .bw-mail.action-compose :is(#composebody,#composebodycontainer,.tox-edit-area) { color-scheme:light; background:#fff; color:#111; }
[data-bw-theme="dark"] .bw-mail:not(.action-compose) #messagebody { color-scheme:dark; background:var(--bw-surface); color:var(--bw-text); }
[data-bw-theme="dark"] #messagebody .bw-message-neutral-surface { background-color:var(--bw-surface)!important; }
[data-bw-theme="dark"] #messagebody .bw-message-neutral-text { color:var(--bw-text)!important; }
[data-bw-theme="dark"] #messagebody .bw-message-neutral-link { color:#8bc8ff!important; }
[data-bw-theme="dark"] .bw-mail.action-compose #composebodycontainer { border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-mail .tox :is(.tox-toolbar,.tox-toolbar__primary,.tox-toolbar__overflow,.tox-statusbar,.tox-menubar) { background:#292a31; color:#ececf0; }
[data-bw-theme="dark"] .bw-mail .tox .tox-tbtn { color:#ececf0; }
[data-bw-theme="dark"] .bw-mail .tox .tox-tbtn svg { fill:#ececf0; }
[data-bw-theme="dark"] .bw-mail.task-login { background:var(--bw-bg); }
[data-bw-theme="dark"] .bw-mail #layout-content,
[data-bw-theme="dark"] .bw-mail #layout-list>.footer,
[data-bw-theme="dark"] .bw-mail #layout-content>.footer,
[data-bw-theme="dark"] .bw-mail.action-compose :is(#compose-content,.formbuttons) { background:var(--bw-surface); color:var(--bw-text); }
[data-bw-theme="dark"] #bw-search-slot .searchbar a,
[data-bw-theme="dark"] .bw-mail .footer a { color:var(--bw-muted); }
[data-bw-theme="dark"] .bw-mail.action-compose :is(.bw-compose-tools a,#compose_to .input-group-append a) { background:var(--bw-search); }
[data-bw-theme="dark"] .bw-mail.action-compose .upload-form { color:var(--bw-muted); }
[data-bw-theme="dark"] .bw-mail.task-settings :is(.content,#preferences-details),
[data-bw-theme="dark"] .bw-mail.task-addressbook #contact-details,
[data-bw-theme="dark"] .bw-mail .ui-dialog .ui-dialog-buttonpane { background:var(--bw-surface); color:var(--bw-text); }
[data-bw-theme="dark"] .bw-mail :is(.propform legend,.formcontent legend,.bw-account-name) { color:var(--bw-text); }
[data-bw-theme="dark"] .bw-mail #layout-list>.footer { background:var(--bw-surface)!important; }
[data-bw-theme="dark"] .bw-mail { scrollbar-color:#555660 var(--bw-bg); }
[data-bw-theme="dark"] .bw-mail.task-settings:not(.bw-shell),
[data-bw-theme="dark"] .bw-mail.task-addressbook:not(.bw-shell),
[data-bw-theme="dark"] .bw-mail.formcontainer { background:var(--bw-surface); color:var(--bw-text); }
[data-bw-theme="dark"] .bw-shell #layout-sidebar>.header { background:var(--bw-bg); color:var(--bw-text); }
[data-bw-theme="dark"] .bw-mail :is(#sections-table,#contacts-table) td { color:var(--bw-text); border-color:var(--bw-border); }
@media print { html[data-bw-theme="dark"] { color-scheme:light; --bw-bg:#fff; --bw-surface:#fff; --bw-text:#111; } }

/* Match the reading card selector's specificity so Gmail's light card cannot win. */
[data-bw-theme="dark"] .bw-mail #message-content .attachmentslist li { background:var(--bw-search);color:var(--bw-text);border-color:var(--bw-border); }
[data-bw-theme="dark"] .bw-mail #message-content .attachmentslist li:hover { border-color:var(--bw-brand-line); }
[data-bw-theme="dark"] .bw-mail.action-compose :is(#composebodycontainer,#composebody,.tox-edit-area,.tox-edit-area__iframe) {
  background:#1f2024!important;color:#e4e5e9;
}
