body .app-menu-button, body .app-sidebar-collapse-button {
    width: 30px; height: 30px; min-width: 30px; border-radius: 8px;
    border: 1px solid var(--theme-border, #d9e2eb);
    background: var(--theme-surface, #fff); color: var(--theme-text, #26384b);
    font-size: 16px; cursor: pointer; transition: background .15s, color .15s;
}
body .app-menu-button:hover, body .app-sidebar-collapse-button:hover { background: var(--theme-primary-soft, #edf4fc); }
body .app-sidebar-collapse-button i { font-size: 14px; }
.app-header-username { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.app-message-bell {
    position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 34px; height: 34px; border-radius: 10px;
    border: 1px solid var(--theme-border, #d9e2eb); color: var(--theme-text, #31475d);
    background: var(--theme-surface, #fff); text-decoration: none; font-size: 1rem;
}
.app-message-bell:hover { background: var(--theme-primary-soft, #edf4fc); }
.app-message-bell.has-unread { color: var(--theme-primary, #3978c5); }
.app-message-count {
    position: absolute; top: -5px; inset-inline-end: -7px; min-width: 19px; height: 19px;
    padding-inline: 4px; display: grid; place-items: center; border-radius: 12px;
    background: #e15b64; color: #fff; font-size: .62rem; font-weight: 700;
    border: 2px solid var(--theme-surface, #fff);
}
.home-dashboard { max-width: 1440px; margin-inline: auto; color: var(--theme-text, #26384b); }
.filter-test-page { max-width: 1450px; margin-inline: auto; }
.filter-test-context { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; font-size: .78rem; }
.filter-test-context strong { color: var(--theme-text, #26384b); }
.filter-test-context span { color: var(--theme-muted, #728296); }
.filter-test-selected { background: var(--theme-primary-soft, #edf4fc); border: 1px solid var(--theme-border, #d9e2eb); border-radius: 9px; padding: 12px; }
.filter-test-page .form-label, .filter-test-values { font-size: .8rem; }
.filter-test-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.home-welcome {
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    border: 1px solid var(--theme-border, #d9e2eb); border-radius: 18px;
    background: linear-gradient(135deg, var(--theme-surface, #fff), var(--theme-primary-soft, #edf4fc)); padding: 28px;
}
.home-eyebrow { color: var(--theme-primary, #3978c5); font-size: .75rem; font-weight: 600; }
.home-welcome h1 { font-size: clamp(1.15rem, 2vw, 1.7rem); font-weight: 800; margin: 10px 0; }
.home-welcome p { font-size: .84rem; color: var(--theme-muted, #728296); line-height: 1.9; margin-bottom: 14px; }
.home-role { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; background: var(--theme-surface, #fff); padding: 5px 10px; font-size: .72rem; }
.home-welcome-symbol { width: 90px; height: 90px; display: grid; place-items: center; flex-shrink: 0; font-size: 3.2rem; color: var(--theme-primary, #3978c5); border-radius: 24px; background: var(--theme-primary-soft, #edf4fc); }
.home-section-heading { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.home-section-heading h2, .home-workflow h2 { font-size: .97rem; font-weight: 700; margin: 0; }
.home-section-heading span { font-size: .72rem; color: var(--theme-muted, #728296); }
.home-module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px;padding:5px }
.home-module { background: var(--theme-surface, #fff); border: 1px solid var(--theme-border, #d9e2eb); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; }
.home-module-icon { width: 40px; height: 40px; display: grid; place-items: center; background: var(--theme-primary-soft, #edf4fc); color: var(--theme-primary, #3978c5); border-radius: 11px; font-size: 1.2rem; }
.home-module h3 { margin: 16px 0 8px; font-size: .94rem; font-weight: 700; }
.home-module h3 a { color: inherit; text-decoration: none; }
.home-module p { color: var(--theme-muted, #728296); font-size: .76rem; line-height: 1.9; flex: 1; }
.home-module-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--theme-border, #d9e2eb); font-size: .73rem; }
.home-module-actions a { color: var(--theme-primary, #3978c5); text-decoration: none; }
.home-create-link { border-radius: 6px; padding: 4px 6px; background: var(--theme-primary-soft, #edf4fc); }
.home-workflow, .home-access-note { padding: 20px; border-radius: 14px; border: 1px solid var(--theme-border, #d9e2eb); background: var(--theme-surface, #fff); margin-top: 18px; }
.home-workflow p { font-size: .8rem; margin: 12px 0 8px; }
.home-workflow small { font-size: .72rem; color: var(--theme-muted, #728296); }
.order-progress { height: 9px; background: var(--theme-border, #dce5ee); border-radius: 10px; overflow: hidden; }
.order-progress .progress-bar { border-radius: 10px; transition: width .3s ease; }
.order-progress .progress-bar.bg-success { background: linear-gradient(90deg, #24947b, #45bf9b) !important; }
.order-progress .progress-bar.bg-primary { background: linear-gradient(90deg, #477ccc, #65a5ed) !important; }
@media (max-width: 575.98px) {
    .home-welcome { padding: 20px; }
    .home-welcome-symbol { display: none; }
    .app-header-username { max-width: 90px; font-size: .7rem; }
}

/* Dark formula cards use the current plastic-container markup. */
body[data-theme="dark"] .formula-plastic-container {
    background: linear-gradient(145deg, #293a4d, #1b2939) !important;
    border-color: #42546a !important; box-shadow: 0 8px 22px #0004, inset 0 1px 0 #ffffff0d; color: #e1eaf5;
}
body[data-theme="dark"] :is(.plastic-rim, .plastic-rim-inner) { background: linear-gradient(#40546b, #2d4055) !important; border-color: #4a5e75 !important; }
body[data-theme="dark"] .formula-plastic-container .plastic-inner { background: linear-gradient(160deg, #293b50, #1c2b3c) !important; border-color: #42546a; box-shadow: inset 0 1px 0 #ffffff0a; }
body[data-theme="dark"] .formula-plastic-container :is(.formula-code-display, .code-part) { background: #24364b !important; border-color: #486078 !important; box-shadow: none; }
body[data-theme="dark"] .plastic-inner::after { opacity: .08; }
body[data-theme="dark"] :is(.plastic-rim-highlight, .plastic-inner)::before { opacity: .08; }
body[data-theme="dark"] .formula-plastic-container :is(.formula-info, .formula-container-footer) { background: transparent !important; border-color: #40536a !important; }
body[data-theme="dark"] .formula-plastic-container :is(.formula-base-name, .formula-info-row > strong, .formula-color-box > strong, .formula-code-display, .code-part, .formula-container-n) { color: #e4edf8 !important; }
body[data-theme="dark"] .formula-plastic-container :is(.formula-color-box, .formula-container-n, .formula-type-badge) { background: #304458 !important; border-color: #486078 !important; }
body[data-theme="dark"] .formula-plastic-container :is(.formula-info-row > span, .formula-code-meaning, .formula-color-label, .update-tooltip, .code-separator) { color: #b2c2d6 !important; }
body[data-theme="dark"] .formula-plastic-container .tooltip-content { background: #1c2a3c !important; border-color: #40536a !important; color: #e4edf8 !important; }
body[data-theme="dark"] .formula-status-liquid { border-color: #42566b !important; }
body[data-theme="dark"] .formula-status-liquid.status-liquid-draft { background: linear-gradient(#3c4c60, #2b3a4e) !important; color: #dce6f2 !important; }
body[data-theme="dark"] .formula-status-liquid.status-liquid-submitted { background: linear-gradient(#284d70, #203b57) !important; color: #b9dcff !important; }
body[data-theme="dark"] .formula-status-liquid.status-liquid-approved { background: linear-gradient(#245344, #1c3d34) !important; color: #adebd3 !important; }
body[data-theme="dark"] .formula-status-liquid.status-liquid-rejected { background: linear-gradient(#61363f, #472930) !important; color: #ffc0c8 !important; }
body[data-theme="dark"] :is(.formula-create-page, .formula-edit-page, .formula-details-page) :is(.readonly-field, .formula-summary, .formula-info-grid, .form-select, .base-material-row, .weight-input-group, .formula-table tfoot, .formula-table tfoot th) { background: #233348 !important; color: #e4edf8 !important; border-color: #40536a !important; }
body[data-theme="dark"] .formula-modal :is(.formula-modal-header, .formula-modal-title, .formula-modal-base, strong) { color: #e4edf8 !important; }
body[data-theme="dark"] .formula-modal-header { background: #25374d !important; border-color: #40536a !important; }

/* Messenger inline light colors are overridden with scoped selectors. */
body[data-theme="dark"] .gmail-messages-page { background: #142031; color: #e0e9f4; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-app, .gmail-topbar, .gmail-sidebar, .gmail-main, .gmail-toolbar, .gmail-conversation-head, .gmail-mailbox, .gmail-mailbox-item, .gmail-letter, .gmail-compose-modal, .gmail-compose-body, .gmail-modal-head, .gmail-compose-footer, .gmail-decision-box, .gmail-attachment) { background: #1c2a3b; color: #e0e9f4; border-color: #384b62; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-messages, .gmail-mailbox-pagination, .gmail-empty, .gmail-decision-panel) { background: #172436; color: #b9c9dd; border-color: #384b62; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-brand, .gmail-recipient-info strong, .gmail-toolbar-title, .gmail-modal-head strong, .gmail-mailbox-subject, .gmail-message-body, .gmail-letter-body, .gmail-letter-subject, .gmail-decision-title, .gmail-user-info strong, .gmail-mailbox-row strong) { color: #e0e9f4; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-letter-header, .gmail-letter-meta, .gmail-message-time, .gmail-message-author, .gmail-user-info small, .gmail-recipient-info small, .gmail-mailbox-preview, .gmail-mailbox-row time, .gmail-side-title, .gmail-toolbar-title span, .gmail-field label) { color: #9fb2cc; border-color: #384b62; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-nav button, .gmail-user, .gmail-icon-btn, .gmail-folder-buttons button, .gmail-mode button, .gmail-modal-close, .gmail-attach-label) { background: transparent; color: #bdcce0; border-color: #3d526b; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-nav button.active, .gmail-user.active, .gmail-folder-buttons button.active, .gmail-mode button.active, .gmail-mailbox-item.unread) { background: #294563; color: #d3e7ff; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-user:hover, .gmail-nav button:hover, .gmail-icon-btn:hover, .gmail-mailbox-item:hover, .gmail-attach-label:hover) { background: #2a3e56; color: #eef5ff; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-avatar, .gmail-mailbox-avatar, .gmail-brand-icon, .gmail-empty-icon, .gmail-file-chip) { background: #304762; color: #c9e1ff; border-color: #48627f; }
body[data-theme="dark"] .gmail-messages-page .gmail-compose { background: #294b74; color: #d8e9ff; }
body[data-theme="dark"] .gmail-messages-page .gmail-mode { background: #162538; }
body[data-theme="dark"] .gmail-messages-page .gmail-modal-close:hover { background: #32465f; }
body[data-theme="dark"] .gmail-messages-page .gmail-message.theirs { background: #283b52; color: #e0e9f4; border-color: #415974; }
body[data-theme="dark"] .gmail-messages-page .gmail-message.mine { background: #244b44; color: #e0f1e9; border-color: #396c5e; }
body[data-theme="dark"] .gmail-messages-page :is(.gmail-field input, .gmail-field textarea, .gmail-field select, .gmail-list-search input, .gmail-search input, textarea.form-control) { background: #162538 !important; color: #e0e9f4 !important; border-color: #415872 !important; }
body[data-theme="dark"] .gmail-messages-page :is(input, textarea)::placeholder { color: #8fa4bf; }
body[data-theme="dark"] .gmail-modal-backdrop { background: #050d1bbd; }
body[data-theme="dark"] .gmail-messages-page .gmail-error { background: #4d2d39; color: #ffc4d0; }
