/* ============================================================================
   MMStudio — Dark Mode
   ----------------------------------------------------------------------------
   Activated by adding `theme-dark` to the <html> element. Toggle is wired
   from assets/js/lib/theme-toggle.js (persists in localStorage + respects OS
   prefers-color-scheme).

   Palette is Material-style "elevated dark" — base #121212 with progressively
   lighter surfaces simulating elevation, ~87%-white text, brand orange
   retained but slightly clamped so it doesn't vibrate on dark.

   Order of sections:
   1. Tokens (CSS custom properties)
   2. Global resets (body / scrollbars / selection)
   3. Bootstrap 4 surfaces (cards, modals, dropdowns, forms, tables, alerts,
      buttons, list-group, pagination, nav, breadcrumb, badges, progress)
   4. Project-specific (navbar, sidebar, dashboard layout, profile dropdown,
      bell notifications, profile cards, project tiles, chat panels)
   5. Third-party widgets (SweetAlert2 / mm-dialog, Trumbowyg, DataTables,
      jQuery UI, Croppie, select2, jcrop)
   6. Toggle UI button + utility classes
   7. Print: force back to light (printers)
   ============================================================================ */


/* ----------------------------------------------------------------------------
   1. Tokens
   ---------------------------------------------------------------------------- */
html.theme-dark {
    color-scheme: dark;

    /* Surfaces — Material elevation overlays on a #121212 base */
    --mm-bg:            #121212;   /* page */
    --mm-surface-1:     #1c1c1e;   /* default card */
    --mm-surface-2:     #232325;   /* elevated card / dropdown */
    --mm-surface-3:     #2a2a2d;   /* modal / popover */
    --mm-surface-4:     #303033;   /* highest elevation */
    --mm-surface-hover: #2f2f33;
    --mm-surface-input: #1f1f22;   /* form fields */

    /* Text. Primary is pure white and secondary stays clearly light —
     * everything that was a dark ink colour in light mode reads bright
     * on dark. Only --mm-text-faint stays low: it is used solely for
     * input placeholders + disabled controls, which are de-emphasised
     * in light mode too (light-grey, never dark), so they are out of
     * scope for the lighten pass. */
    --mm-text:          #ffffff;
    --mm-text-muted:    rgba(255, 255, 255, 0.82);
    --mm-text-faint:    rgba(255, 255, 255, 0.38);
    --mm-text-inverse:  #1c1c1e;

    /* Lines */
    --mm-border:        rgba(255, 255, 255, 0.12);
    --mm-border-strong: rgba(255, 255, 255, 0.22);
    --mm-divider:       rgba(255, 255, 255, 0.08);

    /* Brand — slightly desaturated for dark surfaces */
    --mm-brand:         #ff6b47;
    --mm-brand-hover:   #ff8567;
    --mm-brand-active:  #e75a3a;
    --mm-brand-soft:    rgba(255, 107, 71, 0.16);
    --mm-selection:     rgba(255, 107, 71, 0.70);  /* brand orange, text-selection highlight */

    /* Chat member-chip role outlines — brighter than the light-mode
     * brand colours so the pill outline reads clearly on the dark
     * chat panel (consumed by the inline var() in detail.php). */
    --mm-chip-admin:    #7a61ab;          /* AdminCustomer — purple, midway between the light #583F80 and a full-bright tint */
    --mm-chip-manager:  var(--mm-brand);  /* Manager — dark-mode brand orange */

    /* Semantic */
    --mm-success:       #4ade80;
    --mm-success-soft:  rgba(74, 222, 128, 0.14);
    --mm-warning:       #fbbf24;
    --mm-warning-soft:  rgba(251, 191, 36, 0.14);
    --mm-danger:        #f87171;
    --mm-danger-soft:   rgba(248, 113, 113, 0.14);
    --mm-info:          #60a5fa;
    --mm-info-soft:     rgba(96, 165, 250, 0.14);

    /* Shadows — softer than light mode, but still depth-cuing */
    --mm-shadow-1:      0 1px 2px rgba(0, 0, 0, 0.4);
    --mm-shadow-2:      0 4px 12px rgba(0, 0, 0, 0.5);
    --mm-shadow-3:      0 12px 28px rgba(0, 0, 0, 0.55);

    /* Code / pre / blockquote */
    --mm-code-bg:       #1a1a1c;
    --mm-code-text:     #e0e0e0;

    /* ---- Brand-token overrides ------------------------------------------------
     * Per CONVENTIONS.md the canonical brand palette is defined as CSS custom
     * properties on :root (in detail_posted.php, notification-centre.css,
     * unified-chat.css and others — there is no shared _tokens.css yet). Every
     * page-level `:root { --white: #fff ... }` block keeps using LIGHT values
     * even when the theme flips, which leaves token-driven surfaces (the
     * proposal card on /project/detail, the table headers, brand-tinted chips)
     * stuck in their light-mode colours and effectively invisible on dark.
     *
     * The fix: re-declare every brand token here, scoped to `html.theme-dark`.
     * That selector wins specificity over `:root` (0,1,1 vs 0,0,1), so the
     * dark values take over without touching any of the page-level blocks.
     * Mappings target the *semantic* role of each token, not its literal name:
     *
     *   --white  →  "default surface"  → dark grey
     *   --bg     →  "page background"  → near-black
     *   --soft   →  "subtle fill"      → slightly lighter than page
     *   --line   →  "primary divider"  → low-contrast white
     *   --ink-*  →  "text scale"       → light end of greyscale
     */
    --white:          var(--mm-surface-1);
    --bg:             var(--mm-bg);
    --soft:           var(--mm-surface-2);

    --line:           var(--mm-divider);
    --line-2:         var(--mm-border);

    /* The light-mode ink scale ran #2D405A → #99A2AD (dark navy down to
     * mid-grey). In dark mode every step lifts to the white end of the
     * scale — titles pure white, body almost white, and even the most
     * muted tier stays clearly light. */
    --ink-900:        var(--mm-text);              /* titles  — #ffffff   */
    --ink-700:        rgba(255, 255, 255, 0.95);   /* body    — almost white */
    --ink-500:        rgba(255, 255, 255, 0.82);   /* secondary */
    --ink-400:        rgba(255, 255, 255, 0.68);   /* most muted, still light */

    --primary:        var(--mm-brand);
    --primary-tint:   var(--mm-brand-soft);
    --primary-tint-2: rgba(255, 107, 71, 0.10);

    --purple:         #b89cf0;
    --purple-2:       #d4c2ff;
    --purple-tint:    rgba(180, 156, 240, 0.18);

    --warn:           var(--mm-warning);
    --warn-bg:        var(--mm-warning-soft);
    --warn-line:      rgba(251, 191, 36, 0.35);
    --warn-dark:      #fde68a;
    --warn-body:      rgba(253, 230, 138, 0.85);

    --success:        var(--mm-success);
    --success-bg:     var(--mm-success-soft);

    --ink-tint:       var(--mm-surface-2);

    /* Compat aliases used by older detail-page CSS (legacy + typo) */
    --body:           var(--mm-bg);
    --text-color:     rgba(255, 255, 255, 0.95);
    --boald-text-color: var(--mm-text);
}

/* ----------------------------------------------------------------------------
   2. Global resets
   ---------------------------------------------------------------------------- */
html.theme-dark,
html.theme-dark body {
    background-color: var(--mm-bg) !important;
    color: var(--mm-text);
    /* Light text on dark surfaces benefits from greyscale antialiasing —
     * subpixel rendering (Chrome default on macOS) makes the strokes look
     * heavier and slightly fringed against dark backgrounds. */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page-level structural containers → page background. Bare `section` /
 * `main` are deliberately NOT in this list: user-authored content
 * (the job Brief, chat messages, cover letters) can contain stray
 * <section>/<main> tags, and painting those --mm-bg made them render
 * as a darker box inside the lighter panel — the "two-colour" job
 * page. The layout's own section/main sit inside these containers and
 * inherit the background, so dropping the bare element selectors
 * costs nothing. */
html.theme-dark body.page-template,
html.theme-dark .main-panel,
html.theme-dark .content-wrapper,
html.theme-dark .container-fluid,
html.theme-dark .container,
html.theme-dark .page-body-wrapper,
html.theme-dark section.section {
    background-color: var(--mm-bg) !important;
    color: var(--mm-text);
}

html.theme-dark p,
html.theme-dark .text-dark,
html.theme-dark .text-body,
html.theme-dark .text-black {
    color: var(--mm-text) !important;
}

html.theme-dark .text-muted,
html.theme-dark .text-secondary {
    color: var(--mm-text-muted) !important;
}

/* Content links go brand-orange. `:not(.btn)` keeps the rule off
 * link-styled BUTTONS (`<a class="btn ...">`) — those carry their own
 * fill + text colour, and the blanket rule (esp. its :visited arm) was
 * repainting a visited button's label orange-on-orange. */
html.theme-dark a:not(.btn),
html.theme-dark a:not(.btn):visited {
    color: var(--mm-brand);
}
html.theme-dark a:not(.btn):hover,
html.theme-dark a:not(.btn):focus {
    color: var(--mm-brand-hover);
}
/* Data-table links are content, not calls-to-action — the blanket
 * orange `a` rule above repaints things like the sales-report project
 * title (.proj-row-link, designed to inherit) and the project-list
 * manager/title cells. Restore them to normal text colour. */
html.theme-dark .proj-row-link,
html.theme-dark .proj-row-link:visited,
html.theme-dark .pro-section table td a:not(.btn),
html.theme-dark .pro-section table td a:not(.btn):visited {
    color: inherit !important;
}
/* "Job is Locked" indicator (the lock icon + label that sits above the
 * proposals card). Page-scoped CSS pins the label to #2A2A2A (near
 * black) and the lock-icon.svg has a baked-in #08376A dark-blue fill —
 * both invisible on the dark background. Lift the label to muted
 * white; convert the dark SVG to muted white via the brightness(0)+
 * invert(1)+opacity trick so it matches the text. */
html.theme-dark .lock_job_prop_desc > * {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .lock_job_prop_desc .lock-icon {
    filter: brightness(0) invert(1) opacity(0.82) !important;
}
/* Keep "See Why" on brand orange — it already reads, but lift it from
 * #EF5537 to the dark-mode brand variant for consistency. */
html.theme-dark .lock_job_prop_desc .lock_see_why {
    color: var(--mm-brand) !important;
}

/* "Job Locked" speech-bubble tooltip (.see_why_block). Page-scoped CSS
 * in project/task.php + task/proposal.php hard-codes a white panel
 * (#FFFFFF + #FFFFFF tail), dark-ink title and grey desc — the title
 * reads on dark by coincidence but the desc is invisible on the white
 * panel showing through. Re-skin the whole tooltip for dark. */
html.theme-dark .see_why_block {
    background: var(--mm-surface-2) !important;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.6) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .see_why_block .see_why_box_title,
html.theme-dark .see_why_block .see_why_box_title b {
    color: var(--mm-text) !important;
}
html.theme-dark .see_why_block .see_why_box_desc {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .see_why_block .see_why_box_desc b {
    color: var(--mm-text) !important;
}
html.theme-dark .see_why_block .see_why_box_link {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .see_why_block .see_why_box_link a {
    color: var(--mm-brand) !important;
}
html.theme-dark .see_why_block .close_see_why {
    color: var(--mm-text-muted) !important;
}
/* The little upward triangle tail that hangs off the top of the tooltip
 * — light mode draws it via border-bottom: 15px solid #FFFFFF. */
html.theme-dark .see_why_block::before {
    border-bottom-color: var(--mm-surface-2) !important;
}
/* Creator/freelancer name in the project Jobs table is the one
 * deliberate exception: light mode paints `.mm-table-name` brand-orange
 * (#EF5537) as the "assigned to" cue, and the blanket exemption above
 * just flattened it to inherited white. Re-pin it to the brand accent.
 * `:not(.btn)` lifts specificity over the exemption so it always wins. */
/* Mobile only — mirrors the light-mode rule which paints
 * `.mm-table-name` brand-orange (#EF5537) under
 * `@media (max-width:575px)`. On desktop those names are plain td
 * text in BOTH themes (light: inherits #5B5876 navy-grey; dark:
 * inherits --mm-text white) — we leave the column-link colouring
 * alone so it doesn't read as a sea of orange across every row. */
@media (max-width: 575px) {
    html.theme-dark .pro-section table td a.mm-table-name:not(.btn),
    html.theme-dark .pro-section table td a.mm-table-name:not(.btn):visited,
    html.theme-dark .pro-section table td.mm-table-name,
    html.theme-dark .pro-section table td.mm-table-name a:not(.btn) {
        color: var(--mm-brand) !important;
    }
}
/* The freelance sales-report earning value is `var(--purple)` — a
 * violet on dark; use plain white text. The desktop table uses
 * .row-amount--accent and the mobile project card uses .mob-proj__earn
 * — cover both so the value matches across viewports. */
html.theme-dark .row-amount--accent,
html.theme-dark .mm-app .mob-proj__earn {
    color: var(--mm-text) !important;
}
/* Sales project-card status pills — on dark they all flattened to the
 * same dull grey. Colour them semantically so each status reads at a
 * glance: INITIAL neutral, EXTENSION purple, PENDING amber, APPROVED
 * green. (--ext / --yes are listed after the base rule so they win the
 * same-specificity tie.) */
html.theme-dark .mm-app .mob-proj__stage {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text-muted) !important;
}
html.theme-dark .mm-app .mob-proj__stage--ext {
    background: rgba(180, 156, 240, 0.18) !important;
    color: #b89cf0 !important;
}
html.theme-dark .mm-app .mob-proj__chip--no {
    background: var(--mm-warning-soft) !important;
    color: var(--mm-warning) !important;
}
html.theme-dark .mm-app .mob-proj__chip--yes {
    background: var(--mm-success-soft) !important;
    color: var(--mm-success) !important;
}
/* Desktop sales table — same semantic colours as the mobile cards
 * above. The eligibility chip is PENDING (--no) / APPROVED (--yes); the
 * stage label is plain text and already reads neutral / purple. */
html.theme-dark .mm-app .elig-chip--no {
    background: var(--mm-warning-soft) !important;
    color: var(--mm-warning) !important;
}
html.theme-dark .mm-app .elig-chip--yes {
    background: var(--mm-success-soft) !important;
    color: var(--mm-success) !important;
}
/* Salesperson name (.sp-name) rendered brand-orange on dark: the <a>
 * variant loses a specificity battle to the blanket `a:not(.btn)`
 * rule, and the <div> variant (mobile cards) inherits orange from a
 * clickable card ancestor. Match `.sp-name` directly — both element
 * types — and pin it to ink/white text. */
html.theme-dark .mm-app .sp-name {
    color: var(--mm-text) !important;
}
/* Proposal capacity tags (.pm-badge*) — the #54387F purple outline +
 * label barely register on the dark proposal card. Brighten both to a
 * clear, legible light purple. */
html.theme-dark .pm-badge,
html.theme-dark .pm-badge-available,
html.theme-dark .pm-badge-high,
html.theme-dark .pm-badge-capacity {
    border-color: #9b82d6 !important;
    color: #9b82d6 !important;
}
/* The (i) glyph in the pill is an <img> SVG with a hard-coded #54387F
 * stroke — it can't inherit the pill's `color`. brightness() preserves
 * the purple hue while lifting it to roughly match the #9b82d6 label;
 * saturate() trims the slight over-vividness. */
html.theme-dark .pm-badge-i img {
    filter: brightness(1.85) saturate(0.85);
}

/* "Inverse" buttons (.btn-inverse-* — tinted bg + solid-hue text, used
 * for Edit/Delete on the taxonomy admin tables). The text is the FULL
 * hue (e.g. #0069D9 blue), which is too dark on the dark tinted fill —
 * lift each to a light tint of its hue. Icons inherit `color`. */
html.theme-dark .btn-inverse-primary {
    color: #8ab4ff !important;
}
html.theme-dark .btn-inverse-info {
    color: #5fd3e6 !important;
}
html.theme-dark .btn-inverse-danger {
    color: var(--mm-danger) !important;
}
html.theme-dark .btn-inverse-success {
    color: var(--mm-success) !important;
}
html.theme-dark .btn-inverse-warning {
    color: var(--mm-warning) !important;
}
html.theme-dark .btn-inverse-secondary,
html.theme-dark .btn-inverse-dark,
html.theme-dark .btn-inverse-light {
    color: var(--mm-text) !important;
}
/* Amount pills on the Wallet page (`.badge.btn-inverse-{success,danger}`)
 * — the theme paints success a solid green but danger only a 20%-alpha
 * red, which on the dark page is a muddy near-unreadable maroon. Give
 * the danger pill a solid red so it reads as clearly as the green one,
 * and put white text on both for a consistent solid-pill look. */
html.theme-dark .badge.btn-inverse-danger {
    background-color: #ef4444 !important;
    color: #fff !important;
}
html.theme-dark .badge.btn-inverse-success {
    color: #fff !important;
}
/* The "Pending" withdrawal-status badge uses btn-inverse-warning
 * (was danger/red — misleading, pending isn't a failure). Give it a
 * solid amber pill matching the green/red ones. */
html.theme-dark .badge.btn-inverse-warning {
    background-color: #d97706 !important;
    color: #fff !important;
}
/* `.btn-theme-secondary` (e.g. the Wallet "Withdraw Funds" button) is a
 * dark purple that barely separates from the dark page. Give it the
 * brand-orange fill on dark so the action is clear and on-brand.
 * Exclude `.submit-btn` — that class pins its own brand-orange fill
 * (e.g. the Deliver button) already. */
html.theme-dark .btn-theme-secondary:not(.submit-btn) {
    background-color: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
    color: #fff !important;
}
/* Proposal editor footer (project/detail_posted.php) — the char-counter
 * bar under the cover-letter textarea is pinned #FAFBFC, so it reads as
 * a white strip across the bottom of the dark editor. */
html.theme-dark .editor-footer {
    background: var(--mm-surface-2) !important;
    border-top-color: var(--mm-border) !important;
}
/* Account-menu wallet sub-card (account-menu.css) — the card is pinned
 * to a near-white lavender (--wallet-tint); under dark mode the balance
 * (--ink-900) remaps to white and vanishes on it. Give the card a dark
 * surface and lift the wallet glyph to a brighter violet. */
html.theme-dark .am-wallet {
    background: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .am-wallet__amount {
    color: var(--mm-text) !important;
}
html.theme-dark .am-wallet__label svg,
html.theme-dark .am-wallet-icon {
    color: #8b5cf6 !important;
}
/* Account-menu rows — "Edit Profile" gets repainted orange by the
 * blanket dark `a` rule and "Logout" (the --danger row) is amber on
 * both its text and icon. Keep all the row text and the logout icon
 * white. */
html.theme-dark .am-row__link,
html.theme-dark .am-row__link:visited,
html.theme-dark .am-row__link:hover,
html.theme-dark .am-row__link--danger,
html.theme-dark .am-row__link--danger:hover,
html.theme-dark .am-row__link--danger .am-row__icon {
    color: var(--mm-text) !important;
}
/* Sales-report total-row earning (.val-elig) is var(--purple) — a
 * bright violet on dark. Use plain text, matching the per-row fix. */
html.theme-dark .val-elig {
    color: var(--mm-text) !important;
}
/* Mobile sidebar drawer — the profile-block divider
 * (.navbar-brand-mobile bottom border) is a near-white #E8EFF6 that
 * glares on the dark drawer. Dim it to --mm-border. */
html.theme-dark .navbar-brand-mobile.am-mobile {
    border-bottom-color: var(--mm-border) !important;
}
/* Navbar mobile page-title — light-mode navy on the dark header bar. */
html.theme-dark .mm-page-title {
    color: var(--mm-text) !important;
}
/* Mobile hamburger — the visible icon is an <img> (bars.svg) whose
 * paths are filled #2B003F (dark purple), near-invisible on the dark
 * header. brightness(0) flattens it to black, invert(1) lifts it to
 * white. (color: handles the alternate mdi icon-font variant.) */
html.theme-dark .navbar-toggler {
    color: var(--mm-text) !important;
}
html.theme-dark .navbar-toggler img.nav-bars,
html.theme-dark img.nav-bars {
    filter: brightness(0) invert(1);
}
/* Proposal / revisions timeline (task/proposal.php) — the update
 * sub-text (.new-uptext) and the timestamps (.mobil-time-*) are pinned
 * #56606D, a dark grey that's near-unreadable on the dark cards. The
 * budget-update entry (.bud-text) wraps its whole line in a #56606D
 * span, so that row reads dim too. */
html.theme-dark .new-uptext,
html.theme-dark .mobil-time-show,
html.theme-dark .mobil-time-hide {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .bud-text,
html.theme-dark .bud-text span,
html.theme-dark .bud-text b {
    color: var(--mm-text) !important;
}
/* The "Budget: ..." sub-line of a budget-update entry (.budget-text)
 * pins its columns to #56606D — barely visible on dark. Lift to muted
 * white; the amount keeps its own orange. */
html.theme-dark .budget-text,
html.theme-dark .budget-text div {
    color: var(--mm-text-muted) !important;
}
/* The "Attachments" label in a delivery entry is pinned to a dark
 * navy #2D405A — near-invisible on the dark card. (The filename link
 * below it carries an inline #56606D and is fixed in proposal.php.) */
html.theme-dark .attachments-text,
html.theme-dark .attachments-text span {
    color: var(--mm-text) !important;
}
/* "Deliver your work" file picker (task/proposal.php) — the
 * .custom-file-upload label is a light #ededed slab with #56606D text
 * + icon, and the "No file choosen" text is a dim #78808A. */
html.theme-dark .custom-file-upload {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .custom-file-upload svg path {
    stroke: currentColor;
}
html.theme-dark .custom-file-upload-text {
    color: var(--mm-text-muted) !important;
}
/* Notification-centre icon bubbles — the per-type tint backgrounds
 * resolve to a low-alpha wash on dark, so even raised they composite
 * dark over the near-black page. Give each type a solid, vivid circle
 * with a white glyph (the .nc-icon SVG strokes currentColor) so the
 * badges read brightly. Colours track the avatar palette. */
html.theme-dark .nc-iconbubble--invite,
html.theme-dark .nc-iconbubble--proposal,
html.theme-dark .nc-iconbubble--project {
    background: #8b5cf6 !important;
    color: #fff !important;
}
html.theme-dark .nc-iconbubble--award,
html.theme-dark .nc-iconbubble--delivery {
    background: #22c55e !important;
    color: #fff !important;
}
html.theme-dark .nc-iconbubble--payment,
html.theme-dark .nc-iconbubble--budget,
html.theme-dark .nc-iconbubble--system {
    background: #ef5537 !important;
    color: #fff !important;
}
html.theme-dark .nc-iconbubble--deadline {
    background: #d97706 !important;
    color: #fff !important;
}
html.theme-dark .nc-iconbubble--chat {
    background: #3b82f6 !important;
    color: #fff !important;
}

/* Component-surface links that wrap a whole row (notification popover,
 * chat conversation list, sidebar items): the row's inner spans /
 * titles / previews each set their own colour via `.sc-row__title`,
 * `.sc-row__time`, `.mmc-conv-name`, etc. We MUST NOT paint those
 * inner pieces with the link's brand orange — the title is meant to
 * be readable white/grey, with brand orange reserved for accents.
 *
 * The original dark-mode pass added a broad `html.theme-dark span,
 * h1..h6, p, li, ... { color: inherit }` rule that was meant to
 * undo per-page hard-coded text colours. But because that rule has
 * (0,1,1) specificity, it BEAT every component-class rule like
 * `.sc-row__title { color: var(--ink-700) }` (0,1,0). Inner spans
 * then inherited the brand-orange link colour from the wrapping
 * `<a>` and the whole notification popover (plus chat list, plus
 * any row-link surface) read as muddy orange-on-dark.
 *
 * Removing the inherit rule lets the component classes win. For
 * the case the inherit rule was originally trying to handle — h1
 * / h2 hard-coded to #242424 in main.php's inline <style> — the
 * `.page-template h1..h6` block below already handles it with the
 * !important they need. */

html.theme-dark hr {
    border-top-color: var(--mm-border);
}

/* Text selection — --mm-brand-soft (brand orange at 0.16 alpha) blended
 * over the near-black page reads as a muddy maroon. --mm-selection is
 * the brand orange at a high enough alpha that the highlight reads as
 * a clean warm orange, with white text on top. */
html.theme-dark ::selection {
    background: var(--mm-selection);
    color: #fff;
}

/* Scrollbars */
html.theme-dark ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
html.theme-dark ::-webkit-scrollbar-track {
    background: var(--mm-bg);
}
html.theme-dark ::-webkit-scrollbar-thumb {
    background: #3a3a3d;
    border-radius: 6px;
}
html.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4d;
}
html.theme-dark * {
    scrollbar-color: #3a3a3d var(--mm-bg);
}

/* Page-template inline styles in main.php hard-code colors like #242424 / #fff
   on h1/h2/.text-change/etc. We win specificity with !important on the few
   that matter. */
html.theme-dark h1,
html.theme-dark h2 {
    color: var(--mm-text) !important;
}
html.theme-dark p.text-change {
    color: var(--mm-text) !important;
}


/* ----------------------------------------------------------------------------
   3. Bootstrap 4 surfaces
   ---------------------------------------------------------------------------- */

/* Cards */
html.theme-dark .card,
html.theme-dark .card-header,
html.theme-dark .card-footer,
html.theme-dark .card-body {
    background-color: var(--mm-surface-1);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
/* `.card-body` fills the rounded `.card` flush but has its own
 * border-radius of 0, so its solid dark fill squared off the card's
 * rounded corners on dark. Round it to match the 20px `.card` radius.
 * (An explicit value, not `inherit` — some cards nest .card-body under
 * a plain wrapper div whose radius is 0, which `inherit` would pick
 * up. Where a card's own radius differs, the body simply shows the
 * identically-coloured .card fill in the corner, so this is safe.) */
html.theme-dark .card-body {
    border-radius: 20px;
}
html.theme-dark .card {
    box-shadow: var(--mm-shadow-1);
}
html.theme-dark .bg-white,
html.theme-dark .bg-light {
    background-color: var(--mm-surface-1) !important;
    color: var(--mm-text) !important;
}

/* Modals */
html.theme-dark .modal-content {
    background-color: var(--mm-surface-3);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .modal-header,
html.theme-dark .modal-footer {
    border-color: var(--mm-border);
}
html.theme-dark .modal-backdrop.show {
    opacity: 0.7;
}
html.theme-dark .close,
html.theme-dark .modal-header .close {
    color: var(--mm-text);
    text-shadow: none;
    opacity: 0.7;
}
html.theme-dark .close:hover {
    color: var(--mm-text);
    opacity: 1;
}

/* Dropdowns */
html.theme-dark .dropdown-menu {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
    box-shadow: var(--mm-shadow-2);
}
html.theme-dark .dropdown-item {
    color: var(--mm-text);
}
html.theme-dark .dropdown-item:hover,
html.theme-dark .dropdown-item:focus {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
}
html.theme-dark .dropdown-item.active,
html.theme-dark .dropdown-item:active {
    background-color: var(--mm-brand-soft);
    color: var(--mm-text);
}
html.theme-dark .dropdown-divider {
    border-top-color: var(--mm-divider);
}
html.theme-dark .dropdown-header {
    color: var(--mm-text-muted);
}

/* Forms */
html.theme-dark .form-control,
html.theme-dark .form-control-plaintext,
html.theme-dark .form-select,
html.theme-dark input[type="text"],
html.theme-dark input[type="email"],
html.theme-dark input[type="password"],
html.theme-dark input[type="search"],
html.theme-dark input[type="tel"],
html.theme-dark input[type="url"],
html.theme-dark input[type="number"],
html.theme-dark input[type="date"],
html.theme-dark input[type="time"],
html.theme-dark input[type="datetime-local"],
html.theme-dark textarea,
html.theme-dark select {
    /* The legacy Exertio dashboard template defines `.form-select` and bare
     * `select` with explicit white backgrounds at the same specificity. Pin
     * dark mode with !important on bg + color so the same rule wins on every
     * page regardless of which form-control variant a view chose.
     *
     * Force a 1px --mm-border hairline: several views (e.g. the Exertio
     * `.main-panel .form-control`) zero the border out, which on dark
     * leaves an input indistinguishable from the card behind it. The
     * :focus rule below still repaints the border brand-orange. */
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text) !important;
    border: 1px solid var(--mm-border);
}
/* Native <select> menu options — Chrome+Firefox paint these against the
 * OS dark theme, but only when the field carries the explicit dark bg
 * above. Locking it in on the <option>s themselves so the open menu
 * stays dark even on systems where the OS theme is light. */
html.theme-dark select option,
html.theme-dark .form-select option {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
}
html.theme-dark .form-control:focus,
html.theme-dark input:focus,
html.theme-dark textarea:focus,
html.theme-dark select:focus {
    background-color: var(--mm-surface-input);
    color: var(--mm-text);
    border-color: var(--mm-brand);
    box-shadow: 0 0 0 0.2rem var(--mm-brand-soft);
}
html.theme-dark .form-control::placeholder,
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
    color: var(--mm-text-faint);
    opacity: 1;
}
html.theme-dark .form-control:disabled,
html.theme-dark .form-control[readonly] {
    background-color: #181819;
    color: var(--mm-text-faint);
}
html.theme-dark .input-group-text {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
/* Search inputs (listing-page "Search here", etc.) — give them the
 * stronger border tier so the field reads as a distinct, tappable
 * search affordance rather than melting into the page. */
html.theme-dark input[type="search"] {
    border-color: var(--mm-border-strong);
}
/* Opt search inputs out of the platform-wide orange focus halo
 * applied by `html.theme-dark input:focus` above. Light mode shows
 * no focus outline at all on these fields; the orange border + glow
 * in dark mode was a jarring inconsistency. Keep the stronger-tier
 * border on focus to retain a visible affordance, but drop the
 * brand-colour repaint + box-shadow so the field stays calm.
 * Matching specificity (html.theme-dark + attribute selector + :focus)
 * is enough to beat the broader `html.theme-dark input:focus` rule. */
html.theme-dark input[type="search"]:focus {
    border-color: var(--mm-border-strong);
    box-shadow: none;
}
/* The listing-page search magnifier is a background-image SVG whose
 * paths have no fill — it renders solid black, near-invisible on the
 * dark field. Re-use the EXACT original SVG (same viewBox + transforms
 * + paths, so size/shape are identical) with a white 50%-opacity fill
 * added. position/size still come from the base rule. */
html.theme-dark .dataTables_filter input[type="search"] {
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21.999999 21.999999' width='22' height='22'><g transform='translate(0,-1030.3622)'><g style='opacity:0.5' fill='%23ffffff' transform='translate(60.4,866.24134)'><path d='m -50.5,179.1 c -2.7,0 -4.9,-2.2 -4.9,-4.9 0,-2.7 2.2,-4.9 4.9,-4.9 2.7,0 4.9,2.2 4.9,4.9 0,2.7 -2.2,4.9 -4.9,4.9 z m 0,-8.8 c -2.2,0 -3.9,1.7 -3.9,3.9 0,2.2 1.7,3.9 3.9,3.9 2.2,0 3.9,-1.7 3.9,-3.9 0,-2.2 -1.7,-3.9 -3.9,-3.9 z'/><rect height='5' width='0.89999998' transform='matrix(0.6964,-0.7176,0.7176,0.6964,-142.3938,21.5015)' y='176.60001' x='-46.200001'/></g></g></svg>");
}
html.theme-dark .form-text,
html.theme-dark .help-block {
    color: var(--mm-text-muted);
}
html.theme-dark .custom-control-label::before {
    background-color: var(--mm-surface-input);
    border-color: var(--mm-border-strong);
}
html.theme-dark .custom-file-label {
    background-color: var(--mm-surface-input);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .custom-file-label::after {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
}

/* Add-User modal search (detail.php) — `.custom-search-input` is the
 * pill; the input inside is designed borderless, but the broad dark
 * input[type="text"] rule gave it a fill + border, boxing it inside
 * the pill. Make the pill itself the field surface and keep the input
 * transparent (id selector out-specifies the broad rule). */
html.theme-dark .custom-search-input {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark input#new_email {
    background: transparent !important;
    border: 0 !important;
}

/* Autofill — Chrome/Edge override the dark background otherwise */
html.theme-dark input:-webkit-autofill,
html.theme-dark input:-webkit-autofill:hover,
html.theme-dark input:-webkit-autofill:focus,
html.theme-dark textarea:-webkit-autofill,
html.theme-dark select:-webkit-autofill {
    -webkit-text-fill-color: var(--mm-text);
    -webkit-box-shadow: 0 0 0 1000px var(--mm-surface-input) inset;
    caret-color: var(--mm-text);
    transition: background-color 9999s ease-in-out 0s;
}

/* Tables */
html.theme-dark .table {
    color: var(--mm-text);
    background-color: transparent;
}
html.theme-dark .table thead th {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .table th,
html.theme-dark .table td {
    border-color: var(--mm-border);
}
html.theme-dark .table-striped tbody tr:nth-of-type(odd),
html.theme-dark .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.03);
}
html.theme-dark .table-hover tbody tr:hover,
html.theme-dark .table-hover > tbody > tr:hover > td {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
}
html.theme-dark .table-bordered,
html.theme-dark .table-bordered td,
html.theme-dark .table-bordered th {
    border-color: var(--mm-border);
}

/* Buttons */
html.theme-dark .btn-light,
html.theme-dark .btn-outline-light {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
/* The rating-popover "i" button (.btn-light.thick-font) carries a
 * Material elevation shadow tinted #f8f9fa (near-white); on the dark
 * page it glows as a white halo around the little badge. */
html.theme-dark .btn-light.thick-font {
    box-shadow: none !important;
}
html.theme-dark .btn-light:hover,
html.theme-dark .btn-outline-light:hover {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
    border-color: var(--mm-border-strong);
}
html.theme-dark .btn-secondary {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .btn-secondary:hover,
html.theme-dark .btn-secondary:focus {
    background-color: var(--mm-surface-hover);
    border-color: var(--mm-border-strong);
}
html.theme-dark .btn-outline-secondary,
html.theme-dark .btn-outline-dark {
    color: var(--mm-text);
    border-color: var(--mm-border-strong);
}
html.theme-dark .btn-outline-secondary:hover,
html.theme-dark .btn-outline-dark:hover {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
}
html.theme-dark .btn-link {
    color: var(--mm-brand);
}
html.theme-dark .btn-link:hover {
    color: var(--mm-brand-hover);
}
/* Brand-orange button alias used widely in this codebase */
html.theme-dark .btn-theme,
html.theme-dark .btn-theme:visited {
    background-color: var(--mm-brand);
    border-color: var(--mm-brand);
    color: #fff;
}
html.theme-dark .btn-theme:hover,
html.theme-dark .btn-theme:focus {
    background-color: var(--mm-brand-hover);
    border-color: var(--mm-brand-hover);
    color: #fff;
}

/* List group */
html.theme-dark .list-group-item {
    background-color: var(--mm-surface-1);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .list-group-item-action:hover,
html.theme-dark .list-group-item-action:focus {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
}
html.theme-dark .list-group-item.active {
    background-color: var(--mm-brand);
    border-color: var(--mm-brand);
    color: #fff;
}

/* Pagination */
html.theme-dark .page-link {
    background-color: var(--mm-surface-1);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .page-link:hover {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
    border-color: var(--mm-border-strong);
}
html.theme-dark .page-item.active .page-link {
    background-color: var(--mm-brand);
    border-color: var(--mm-brand);
    color: #fff;
}
html.theme-dark .page-item.disabled .page-link {
    background-color: var(--mm-surface-1);
    color: var(--mm-text-faint);
    border-color: var(--mm-border);
}

/* Nav, tabs, pills */
html.theme-dark .nav-link {
    color: var(--mm-text-muted);
}
html.theme-dark .nav-link:hover,
html.theme-dark .nav-link:focus {
    color: var(--mm-text);
}
/* Sidebar nav icons — the inline SVGs hard-code stroke/fill #56606D, a
 * dark grey that reads dim against the dark sidebar. Drive them off
 * currentColor so each icon matches its link's colour (muted by
 * default, full white on hover / active). */
html.theme-dark .nav-menu-image [stroke] {
    stroke: currentColor;
}
html.theme-dark .nav-menu-image [fill]:not([fill="none"]) {
    fill: currentColor;
}
html.theme-dark .nav-tabs {
    border-bottom-color: var(--mm-border);
}
html.theme-dark .nav-tabs .nav-link {
    border-color: transparent;
    color: var(--mm-text-muted);
}
html.theme-dark .nav-tabs .nav-link:hover {
    border-color: var(--mm-border) var(--mm-border) transparent;
    color: var(--mm-text);
}
html.theme-dark .nav-tabs .nav-link.active,
html.theme-dark .nav-tabs .nav-item.show .nav-link {
    /* Transparent, not --mm-surface-1: the active tab sits directly on
       the card (already that colour), and a solid square-cornered fill
       was painting over the card's rounded top-left corner. */
    background-color: transparent;
    border-color: var(--mm-border) var(--mm-border) transparent;
    color: var(--mm-text);
}
html.theme-dark .nav-pills .nav-link.active {
    background-color: var(--mm-brand);
    color: #fff;
}

/* Breadcrumb */
html.theme-dark .breadcrumb {
    background-color: var(--mm-surface-1);
}
html.theme-dark .breadcrumb-item.active {
    color: var(--mm-text-muted);
}
html.theme-dark .breadcrumb-item + .breadcrumb-item::before {
    color: var(--mm-text-faint);
}

/* Alerts */
html.theme-dark .alert-primary,
html.theme-dark .alert-info {
    background-color: var(--mm-info-soft);
    border-color: var(--mm-info);
    color: var(--mm-text);
}
html.theme-dark .alert-success {
    background-color: var(--mm-success-soft);
    border-color: var(--mm-success);
    color: var(--mm-text);
}
html.theme-dark .alert-warning {
    background-color: var(--mm-warning-soft);
    border-color: var(--mm-warning);
    color: var(--mm-text);
}
html.theme-dark .alert-danger {
    background-color: var(--mm-danger-soft);
    border-color: var(--mm-danger);
    color: var(--mm-text);
}
html.theme-dark .alert-secondary,
html.theme-dark .alert-light,
html.theme-dark .alert-dark {
    background-color: var(--mm-surface-2);
    border-color: var(--mm-border);
    color: var(--mm-text);
}

/* Badges (keep colored backgrounds; tone the light variants) */
html.theme-dark .badge-light {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
}
html.theme-dark .badge-secondary {
    background-color: var(--mm-surface-3);
    color: var(--mm-text);
}

/* Progress */
html.theme-dark .progress {
    background-color: var(--mm-surface-2);
}

/* Tooltip / popover */
html.theme-dark .tooltip-inner {
    background-color: var(--mm-surface-4);
    color: var(--mm-text);
}
html.theme-dark .bs-tooltip-top .arrow::before,
html.theme-dark .bs-tooltip-auto[x-placement^="top"] .arrow::before {
    border-top-color: var(--mm-surface-4);
}
html.theme-dark .bs-tooltip-bottom .arrow::before,
html.theme-dark .bs-tooltip-auto[x-placement^="bottom"] .arrow::before {
    border-bottom-color: var(--mm-surface-4);
}
html.theme-dark .popover {
    background-color: var(--mm-surface-3);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .popover-header {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
    border-bottom-color: var(--mm-border);
}
html.theme-dark .popover-body {
    color: var(--mm-text);
}

/* "Request approval" / "Final delivery" tooltip (.see_request_approval
 * on project/detail.php) — a custom white popup, not a BS .popover.
 * Repaint the bubble, its CSS-triangle arrow and its text for dark. */
html.theme-dark .see_request_approval {
    background: var(--mm-surface-3) !important;
    border: 1px solid var(--mm-border);
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.6) !important;
}
html.theme-dark .see_request_approval::before {
    border-bottom-color: var(--mm-surface-3) !important;
}
html.theme-dark .see_request_approval .see_why_box_title,
html.theme-dark .see_request_approval .close_request_approval {
    color: var(--mm-text) !important;
}
html.theme-dark .see_request_approval .see_why_box_desc,
html.theme-dark .see_request_approval .see_why_box_link {
    color: var(--mm-text-muted) !important;
}

/* Request-approval checklist modal (.ra-modal) — white modal + white
 * .ra-item rows. Repaint to dark surfaces. */
html.theme-dark .ra-modal {
    background: var(--mm-surface-2) !important;
}
html.theme-dark .ra-title {
    color: var(--mm-text) !important;
}
html.theme-dark .ra-close {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .ra-close:hover {
    background: var(--mm-surface-hover) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .ra-item {
    background: var(--mm-surface-3) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .ra-item:hover {
    background: var(--mm-surface-hover) !important;
}
html.theme-dark .ra-item.is-checked {
    background: var(--mm-brand-soft) !important;
    border-color: var(--mm-brand) !important;
}
html.theme-dark .ra-item-title {
    color: var(--mm-text) !important;
}
html.theme-dark .ra-item-sub {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .ra-item input.ra-check {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border-strong) !important;
}
html.theme-dark .ra-item input.ra-check:checked {
    background: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
}
/* The purple "Please confirm..." sub-line + its shield SVG */
html.theme-dark .ra-sub {
    color: #b89cf0 !important;
}
html.theme-dark .ra-sub svg path {
    stroke: #b89cf0 !important;
}
/* Footer — was the only remaining white slab on the dark modal. */
html.theme-dark .ra-actions {
    background: var(--mm-surface-1) !important;
    border-top: 1px solid var(--mm-border) !important;
}
html.theme-dark .ra-btn-primary {
    background: var(--mm-brand) !important;
    color: #fff !important;
}
html.theme-dark .ra-btn-primary:disabled {
    background: rgba(255, 107, 71, 0.32) !important;
    color: rgba(255, 255, 255, 0.55) !important;
}
html.theme-dark .ra-btn-cancel {
    background: transparent !important;
    border-color: var(--mm-brand) !important;
    color: var(--mm-brand) !important;
}
html.theme-dark .ra-btn-cancel:hover {
    background: var(--mm-brand-soft) !important;
}

/* "Job Approval" / release-payment modal (.rp-confirm-*). Same shape
 * as .ra-* / .mm-confirm-* — white panel, light meta box (To/Total),
 * white checklist items, white footer, all hardcoded in layouts/main.php.
 * Re-skin the whole family for dark in one block. */
html.theme-dark .rp-confirm-modal {
    background: var(--mm-surface-2) !important;
}
html.theme-dark .rp-confirm-title {
    color: var(--mm-text) !important;
}
html.theme-dark .rp-confirm-close {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .rp-confirm-close:hover {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
}
/* To/Total meta box */
html.theme-dark .rp-approve-meta {
    background: var(--mm-surface-3) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .rp-approve-meta .label {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .rp-approve-meta .value {
    color: var(--mm-text) !important;
}
html.theme-dark .rp-approve-meta .divider::before {
    background: var(--mm-border-strong) !important;
}
/* Purple "Verify requirements…" sub-line + shield SVG */
html.theme-dark .rp-confirm-sub {
    color: #b89cf0 !important;
}
html.theme-dark .rp-confirm-sub svg path {
    stroke: #b89cf0 !important;
}
/* Checklist items */
html.theme-dark .rp-confirm-item {
    background: var(--mm-surface-3) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .rp-confirm-item:hover {
    background: var(--mm-surface-input) !important;
}
html.theme-dark .rp-confirm-item.is-checked {
    background: var(--mm-brand-soft) !important;
    border-color: var(--mm-brand) !important;
}
html.theme-dark .rp-confirm-item.is-checked .rp-item-title {
    color: var(--mm-brand) !important;
}
html.theme-dark .rp-item-title {
    color: var(--mm-text) !important;
}
html.theme-dark .rp-item-sub {
    color: var(--mm-text-muted) !important;
}
/* Custom checkbox */
html.theme-dark .rp-confirm-item input.rp-approve-check {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border-strong) !important;
}
html.theme-dark .rp-confirm-item input.rp-approve-check:checked {
    background: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
}
/* Footer */
html.theme-dark .rp-confirm-actions {
    background: var(--mm-surface-1) !important;
    border-top: 1px solid var(--mm-border) !important;
}
/* Buttons */
html.theme-dark .rp-btn-danger {
    background: var(--mm-brand) !important;
    color: #fff !important;
}
html.theme-dark .rp-btn-ok:disabled {
    background: rgba(255, 107, 71, 0.32) !important;
    color: rgba(255, 255, 255, 0.55) !important;
}
html.theme-dark .rp-btn-cancel {
    background: transparent !important;
    border-color: var(--mm-brand) !important;
    color: var(--mm-brand) !important;
}
html.theme-dark .rp-btn-cancel:hover {
    background: var(--mm-brand-soft) !important;
}

/* Code / pre / blockquote */
html.theme-dark code,
html.theme-dark kbd,
html.theme-dark pre,
html.theme-dark samp {
    background-color: var(--mm-code-bg);
    color: var(--mm-code-text);
}
html.theme-dark pre {
    border: 1px solid var(--mm-border);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}
html.theme-dark blockquote,
html.theme-dark .blockquote {
    border-left: 3px solid var(--mm-border-strong);
    color: var(--mm-text-muted);
}


/* ----------------------------------------------------------------------------
   4. Project-specific layout (navbar, sidebar, dashboard, profile menu)
   ---------------------------------------------------------------------------- */

/* Top navbar — blends into the surfaces beneath it.
 *
 * Light mode has NO visible header separator, and the reason is subtle:
 * the navbar isn't one uniform colour. Its brand/logo half is the same
 * white as the SIDEBAR below it, and its menu half is the same
 * near-white as the PAGE CONTENT below it — so each half dissolves
 * into whatever it sits above.
 *
 * The earlier dark styling painted the whole navbar one shade LIGHTER
 * (--mm-surface-2) than both the sidebar (--mm-surface-1) and the page
 * (--mm-bg). That made the header read as a separated lighter band —
 * removing the border-bottom didn't help because the tonal STEP itself
 * was the separator.
 *
 * Fix: match each half to what's beneath it, exactly like light mode —
 * brand area → sidebar surface, menu area → page background. The header
 * then has no seam in either theme. */
html.theme-dark .navbar,
html.theme-dark nav.navbar {
    background-color: var(--mm-bg) !important;
}
html.theme-dark .navbar-brand-wrapper,
html.theme-dark .navbar .navbar-brand-wrapper {
    /* Sits above the sidebar — same --mm-surface-1 surface, so the logo
     * area and the sidebar read as one continuous left-column panel. */
    background-color: var(--mm-surface-1) !important;
}
html.theme-dark .navbar-menu-wrapper,
html.theme-dark .navbar .navbar-menu-wrapper {
    /* Sits above the page content — match the page background. */
    background-color: var(--mm-bg) !important;
    color: var(--mm-text);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item .nav-link {
    color: var(--mm-text);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.nav-profile .nav-link .nav-profile-name,
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.nav-profile .nav-profile-meta {
    color: var(--mm-text);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.nav-profile .nav-link small {
    color: var(--mm-text-muted);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .navbar-dropdown,
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .dropdown-menu {
    background-color: var(--mm-surface-2);
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .navbar-dropdown .dropdown-item {
    color: var(--mm-text);
    border-color: var(--mm-divider);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .navbar-dropdown .dropdown-item:hover {
    background-color: var(--mm-surface-hover);
}
html.theme-dark .navbar .navbar-menu-wrapper .navbar-nav .nav-item.dropdown .navbar-dropdown .dropdown-item.wallet-contanier h4 {
    color: var(--mm-text);
}

/* Bell notifications */
html.theme-dark .bell_notifications .total_count_notification,
html.theme-dark .total_count_notification {
    background-color: var(--mm-brand);
    color: #fff;
}
html.theme-dark .all_notification_msg .dropdown-item {
    border-bottom-color: var(--mm-divider) !important;
}

/* Sidebar / left nav (Exertio dashboard template).
 *
 * main.php's inline <style> pins `.sidebar .nav .nav-item .nav-link`
 * to `color: #56606D !important` for the inactive state and uses
 * `.menu-title { color: inherit }`-style cascades; the hardcoded
 * value renders as nearly-black on dark and feels mute / shabby.
 * Force-lift to var(--mm-text-muted) (60% white) so inactive items
 * sit at proper Material "medium emphasis" without competing with
 * the active item.
 *
 * NB: the !important is required to beat the inline-style
 * !important from main.php; reaching for !important against our
 * own stylesheet would violate CONVENTIONS.md, but this overrides
 * a third-party (Exertio template) inline rule. */
/* Sidebar surface: paint the whole left column --mm-surface-1 — the
 * same surface as the logo area (.navbar-brand-wrapper) above it. The
 * left column then reads as one continuous panel, one tonal step
 * lighter than the --mm-bg content, so it separates cleanly from the
 * content without needing a divider line. */
html.theme-dark .sidebar,
html.theme-dark .sidebar-offcanvas,
html.theme-dark .left_dashboard,
html.theme-dark .dashboard_sidebar {
    background-color: var(--mm-surface-1) !important;
    border-right: none;
}
/* The Exertio theme gives .sidebar / .navbar-brand-wrapper a
 * `transition: ... background 0.25s`. On a theme toggle the rest of the
 * page snaps instantly while the sidebar background eased over 0.25s —
 * a visible lag. Drop `background` from the transition (keep `width`
 * for the sidebar minimize animation). Unscoped on purpose so the snap
 * is instant toggling BOTH ways. */
.sidebar,
.sidebar-offcanvas,
.navbar-brand-wrapper,
.navbar .navbar-brand-wrapper {
    transition: width 0.25s !important;
}
html.theme-dark .sidebar .nav .nav-item .nav-link,
html.theme-dark .sidebar .nav .nav-item .nav-link .menu-title,
html.theme-dark .sidebar a {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .sidebar .nav .nav-item .nav-link i,
html.theme-dark .sidebar .nav .nav-item .nav-link .menu-icon {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .sidebar .nav.sub-menu .nav-item .nav-link {
    /* Sub-menu items are real, clickable nav links — keep them at the
     * medium-emphasis tier (same as top-level inactive items). They
     * were briefly on --mm-text-faint (38%, the DISABLED tier) which
     * read as too dim for interactive text. */
    color: var(--mm-text-muted) !important;
}
/* Hover + active state.
 *
 * Light mode doesn't tint the row on hover at all — only the orange
 * `rgba(240,87,56,.1)` highlight on .active, which reads as a barely-
 * visible pale-pink wash against white. On dark, --mm-surface-hover
 * was painting a clear grey block on every hover and --mm-brand-soft
 * (14% orange) was a prominent tint on .active — together making dark
 * mode feel "noisy" relative to light. Drop the hover background
 * entirely (matches light), and dim the active tint to ~4% so it has
 * roughly the same perceived subtlety as the light highlight.
 *
 * The label/icon colour still shifts to brand orange on .active, so the
 * selected row is unambiguous either way. */
html.theme-dark .sidebar .nav .nav-item .nav-link:hover,
html.theme-dark .sidebar .nav .nav-item .nav-link:hover .menu-title {
    color: var(--mm-text) !important;
}
html.theme-dark .sidebar .nav .nav-item.active > .nav-link {
    background-color: rgba(255, 107, 71, 0.04) !important;
}
html.theme-dark .sidebar .nav .nav-item.active > .nav-link,
html.theme-dark .sidebar .nav .nav-item.active > .nav-link .menu-title {
    color: var(--mm-brand) !important;
}
html.theme-dark .sidebar .nav .nav-item.active > .nav-link i,
html.theme-dark .sidebar .nav .nav-item.active > .nav-link .menu-icon {
    color: var(--mm-brand) !important;
}

/* Dashboard / panel containers used across project views */
html.theme-dark .dashboard_outer,
html.theme-dark .dashboard_inner,
html.theme-dark .dashbord_inner,
html.theme-dark .dashboard-card,
html.theme-dark .panel,
html.theme-dark .panel-body,
html.theme-dark .panel-heading,
html.theme-dark .box,
html.theme-dark .white-box,
html.theme-dark .box-shadow,
html.theme-dark .light_box {
    background-color: var(--mm-surface-1) !important;
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .panel-heading,
html.theme-dark .box-header {
    background-color: var(--mm-surface-2) !important;
    border-bottom: 1px solid var(--mm-border);
}

/* mm-table family — the listing-page tables used by /project/ongoing,
 * /project/completed, /project/cancelled, /task/posted, /task/invited
 * and several other admin/PM views. The Exertio dashboard CSS pins the
 * project-title column (td:first-child) on EVERY variant to navy
 * `#181439 !important`, which becomes near-invisible against the dark
 * page bg. Override with the same !important and cover the full set of
 * variant class names so the rule wins regardless of which listing
 * the user is on. The clickable name links inside (manager / sales
 * team / freelancer) keep their brand-orange via their own per-cell
 * rules; this only touches the title column and its inner anchor. */
/* The same theme stylesheet sets `td` body text to `#5B5876` (a dark
 * purple-grey from the light-mode --text-color) on every variant.
 * That's nearly unreadable on dark; sweep it to muted white. */
html.theme-dark .mm-table-completed td,
html.theme-dark .mm-table-ongoing td,
html.theme-dark .mm-table-cancelled td,
html.theme-dark .mm-table-creator-posted td,
html.theme-dark .mm-table-draft-task td,
html.theme-dark .mm-table-posted-task td,
html.theme-dark .mm-table-invited td,
html.theme-dark .mm-table-cd-ongoing td,
html.theme-dark .mm-table-cd-completed td,
html.theme-dark .mm-table-cd-cancelled td,
html.theme-dark .mm-table-task-page td,
html.theme-dark .mm-table td {
    color: var(--mm-text-muted);
    border-bottom-color: var(--mm-border);
}

html.theme-dark .mm-table-completed td:first-child,
html.theme-dark .mm-table-ongoing td:first-child,
html.theme-dark .mm-table-cancelled td:first-child,
html.theme-dark .mm-table-creator-posted td:first-child,
html.theme-dark .mm-table-draft-task td:first-child,
html.theme-dark .mm-table-posted-task td:first-child,
html.theme-dark .mm-table-invited td:first-child,
html.theme-dark .mm-table-cd-ongoing td:first-child,
html.theme-dark .mm-table-cd-completed td:first-child,
html.theme-dark .mm-table-cd-cancelled td:first-child,
html.theme-dark .mm-table-task-page td:first-child,
html.theme-dark .mm-table td:first-child,
html.theme-dark .mm-table-completed td:first-child a,
html.theme-dark .mm-table-ongoing td:first-child a,
html.theme-dark .mm-table-cancelled td:first-child a,
html.theme-dark .mm-table-creator-posted td:first-child a,
html.theme-dark .mm-table-draft-task td:first-child a,
html.theme-dark .mm-table-posted-task td:first-child a,
html.theme-dark .mm-table-invited td:first-child a,
html.theme-dark .mm-table-cd-ongoing td:first-child a,
html.theme-dark .mm-table-cd-completed td:first-child a,
html.theme-dark .mm-table-cd-cancelled td:first-child a,
html.theme-dark .mm-table-task-page td:first-child a,
html.theme-dark .mm-table td:first-child a,
html.theme-dark table.dataTable tbody tr td .mm-table-project-name {
    color: var(--mm-text) !important;
}
/* Secondary line under the job title (the project/sub-title). The theme
 * pins .mm-table-taskName to #5B5876 — a dark purple-grey that's barely
 * legible on the dark page. Lift to muted white (still a step below the
 * title so the hierarchy reads). */
html.theme-dark table.dataTable tbody tr td .mm-table-taskName {
    color: var(--mm-text-muted) !important;
}

/* On phones (<576px) the listing tables collapse to one card per row
 * — the responsive table-to-card transform sets each tr to
 * display:block with its own padding + 10px radius. Light mode reads
 * these as cards purely by surface contrast: a card on a darker page.
 * The card row keeps its normal --mm-surface-1 fill; instead the
 * surface BEHIND the cards (the .card-body that wraps the listing
 * table) is dropped to the page background (--mm-bg) so the cards read
 * as raised against the same backdrop as the rest of the page. NOTE:
 * the tr selector must out-specify the zebra rule
 * `table.dataTable tbody tr.odd|even` (0,3,4) —
 * `table.dataTable[class*="mm-table"] ... tr.odd|even` is (0,4,4). */
@media (max-width: 575.98px) {
    html.theme-dark table.dataTable[class*="mm-table"] tbody tr.odd,
    html.theme-dark table.dataTable[class*="mm-table"] tbody tr.even {
        background-color: var(--mm-surface-1) !important;
        border: 1px solid var(--mm-border-strong) !important;
    }
    /* Match the raw `table[class*="mm-table"]` (the mm-table-* class is
     * in the static markup) rather than `table.dataTable...` — the
     * `.dataTable` class is only added once DataTables initialises, so
     * keying off it left the backdrop at --mm-surface-1 during the
     * load spinner before snapping to --mm-bg. */
    html.theme-dark .card:has(table[class*="mm-table"]),
    html.theme-dark .card-body:has(table[class*="mm-table"]) {
        background-color: var(--mm-bg) !important;
    }
    /* The collapsed-card cells inherit --mm-text-muted (82% white),
     * which looks dim on the card. Lift the body text to full white;
     * cells that carry their own explicit colour (the grey date/amount,
     * brand links) keep it since this only sets the inherited value. */
    html.theme-dark table.dataTable[class*="mm-table"] tbody tr.odd td,
    html.theme-dark table.dataTable[class*="mm-table"] tbody tr.even td {
        color: var(--mm-text) !important;
    }
}
/* The listing card carries the generic dark `.card` drop shadow
 * (rgba(0,0,0,.4) 0 1px 2px). On the dark page that shadow composites
 * to a band darker than the page — a stray "dark line" below the card.
 * A drop shadow does nothing useful on a dark surface, so drop it. */
html.theme-dark .card:has(table[class*="mm-table"]) {
    box-shadow: none !important;
}

/* The "Jobs (n)" pill is an <a class="badge bg-bright-red text-white">
 * — but it inherits the muted cell colour, so its white text rendered
 * at 82%. Pin it to pure white for crisp contrast on the orange fill. */
html.theme-dark a.bg-bright-red,
html.theme-dark .badge.bg-bright-red {
    color: #fff !important;
}

/* Project-jobs top summary card (.mm-top-card-container on
 * /project/task) — a white card whose stat text is already white, so
 * it rendered as a blank white block. Dark surface; divider rules to
 * --mm-border. */
html.theme-dark .mm-top-card-container {
    background-color: var(--mm-surface-1) !important;
}
html.theme-dark .mm-top-card-container .mm-single-top-card {
    border-right-color: var(--mm-border) !important;
}

/* DataTables odd/even rows fall through to white on some tables (e.g.
 * /dashboard/activity_logs). Pin BOTH to the same surface — uniform
 * rows, no zebra striping. */
html.theme-dark table.dataTable tbody tr.odd,
html.theme-dark table.dataTable tbody tr.even {
    background-color: var(--mm-surface-1) !important;
}
/* DataTables `.display`/`.row-border` draw a #ddd row-separator on each
 * tbody cell's border-top — bright on dark. Drop it to --mm-border. */
html.theme-dark table.dataTable.display tbody td,
html.theme-dark table.dataTable.display tbody th,
html.theme-dark table.dataTable.row-border tbody td,
html.theme-dark table.dataTable.row-border tbody th {
    border-top-color: var(--mm-border) !important;
}
/* …and the cells: the activity-log first column kept a white cell fill
 * over the now-dark row. Make cells transparent so the row shows. */
html.theme-dark table.dataTable tbody td {
    background-color: transparent !important;
}
/* DataTables also highlights the SORTED column (.sorting_1/2/3) with an
 * !important white/grey fill — out-rank it so it doesn't relight the
 * sorted column. */
html.theme-dark table.dataTable.display tbody tr > .sorting_1,
html.theme-dark table.dataTable.display tbody tr > .sorting_2,
html.theme-dark table.dataTable.display tbody tr > .sorting_3,
html.theme-dark table.dataTable.order-column tbody tr > .sorting_1,
html.theme-dark table.dataTable.order-column tbody tr > .sorting_2,
html.theme-dark table.dataTable.order-column tbody tr > .sorting_3 {
    background-color: transparent !important;
}

/* Users list (/wpxo_user, .users-table). Every cell is pinned to a
 * near-black navy (#181439 / #101828 name / #5B5876) — invisible on
 * dark. Lift the cells to muted white and the display name to full
 * white. (The "Edit" cell link keeps the brand link colour.) */
html.theme-dark .users-table tbody td,
html.theme-dark .users-table tbody td span,
html.theme-dark .users-table tbody td div,
html.theme-dark .users-table tbody td p {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .users-table tbody td .name {
    color: var(--mm-text) !important;
}

/* Dashboard "info-box" stat tiles (used on /dashboard).
 *
 * Markup is `.info-boxes > .metric + p.matric-bottom`. Light-mode theme
 * leaves the white card; we need to wrap the whole composite tile in a
 * single dark surface so it doesn't render two-tone (dark header / white
 * footer) on /dashboard. The original Exertio CSS sets `.matric-bottom` to
 * white explicitly, so an `!important` is required to override its inline
 * specificity (and it's the rare case where the third-party-override
 * exception in CONVENTIONS.md applies).
 */
html.theme-dark .info-boxes {
    background-color: var(--mm-surface-1) !important;
    border: 1px solid var(--mm-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--mm-shadow-1);
}
html.theme-dark .info-boxes .metric {
    background-color: transparent !important;
    color: var(--mm-text);
}
html.theme-dark .info-boxes .metric .title {
    color: var(--mm-text);
}
html.theme-dark .info-boxes .metric .number {
    /* The Exertio template renders the stat number at font-weight 300.
     * That weight reads fine as dark-on-white but feels under-weight
     * as light-on-dark — the same glyphs look noticeably thinner when
     * inverted. Bump to 400 + a tiny tracking adjustment so the big
     * numerals sit with the same visual weight as the title beside
     * them. The size + 28px remain unchanged. */
    color: var(--mm-text);
    font-weight: 400;
    letter-spacing: -0.01em;
}
html.theme-dark .info-boxes .metric .icon {
    color: var(--mm-text-muted);
}
html.theme-dark .info-boxes p.matric-bottom {
    background-color: transparent !important;
    border-top: 1px solid var(--mm-border);
    color: var(--mm-text-muted);
}
html.theme-dark .info-boxes p.matric-bottom a {
    color: var(--mm-brand);
}
html.theme-dark .info-boxes p.matric-bottom a:hover {
    color: var(--mm-brand-hover);
}
/* Queue-tile counts (Emails/Notifications Queue). The legacy CSS uses
 * the raw `green` / `red` / `gray` named colours, which are muddy and
 * harsh on dark — repoint to the softer dark-mode accent tokens. */
html.theme-dark .queue_span_left {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .queue_span_center {
    color: var(--mm-success) !important;
}
html.theme-dark .queue_span_right {
    color: var(--mm-danger) !important;
}

/* Dashboard bell-icon container (legacy admin/PM widgets) */
html.theme-dark .bell_icon {
    background: var(--mm-surface-2) !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
    color: var(--mm-text);
}
html.theme-dark .bell_icon:hover {
    background: var(--mm-brand-soft) !important;
    color: var(--mm-brand) !important;
    box-shadow: 0 1px 8px rgba(255, 107, 71, 0.3);
}

/* "Welcome back" + page-template dashboard headings (h1/h2 are pinned to
 * #242424 in main.php's inline <style>; .text-change is also hardcoded).
 * We already lifted h1/h2 above, but the dashboard headings often render
 * as h4/h5 too — make sure all heading levels stay readable. */
html.theme-dark .page-template h1,
html.theme-dark .page-template h2,
html.theme-dark .page-template h3,
html.theme-dark .page-template h4,
html.theme-dark .page-template h5,
html.theme-dark .page-template h6 {
    color: var(--mm-text) !important;
}

/* /project/detail (detail_posted.php) hard-coded light surfaces.
 *
 * The big detail view has its own inline <style> block (~3000 lines). The
 * full token sweep documented in DECISIONS.md missed a few `background: #fff`
 * / `background: #fafafa` lines — those land on cards that are heavily used
 * (proposal cards, your-proposal block, brief-edit panel). Overriding the
 * specific class chains keeps the diff to this stylesheet and avoids
 * touching detail_posted.php (which is on the critical path and prone to
 * merge conflicts).
 */
/* Invite Creator page (task/direct_hired) — the search card-body
 * hard-codes a #F5F6FA light fill that out-specifies the generic dark
 * .card-body rule, so the whole search panel stayed near-white; the
 * form label is near-black ink and the section divider is a light
 * grey line. Re-skin all three. */
html.theme-dark .project-details .main-content {
    /* Match the light-mode #E8EFF6 line's visual weight on dark. Even
     * 0.22 (--mm-border-strong) was reading too faint at desktop widths
     * where the divider spans the full card; bump to 0.4 so it has
     * the same "clear thin line" presence as the light theme. */
    border-top-color: rgba(255, 255, 255, 0.4) !important;
}
html.theme-dark .project-details .main-content .card-body {
    background: var(--mm-surface-1) !important;
}
/* Let the page background show through the 15px gap that .card-body's
 * margin-top creates inside the .card wrapper — otherwise the card and
 * card-body share --mm-surface-1 and the panel reads as one dark slab
 * flush against the section divider. Matches the light-mode breathing
 * room (white .card behind a #F5F6FA .card-body). */
html.theme-dark .project-details .main-content .card {
    background: transparent !important;
    box-shadow: none !important;
}
html.theme-dark .project-details .main-content form label {
    color: var(--mm-text) !important;
}
/* …and the creator search-results table below it (page-scoped <style>
 * hard-codes light th/td/border/chip colours). */
html.theme-dark .hire-creator-sec {
    border-color: var(--mm-border) !important;
}
html.theme-dark .hire-creator-sec table thead tr th {
    background: var(--mm-surface-2) !important;
    color: var(--mm-text-muted) !important;
}
html.theme-dark .hire-creator-sec table td {
    border-top-color: var(--mm-border) !important;
}
html.theme-dark .hire-creator-sec .table tbody tr {
    border-color: var(--mm-border) !important;
}
html.theme-dark .hire-creator-sec .table tbody tr td a {
    color: var(--mm-text) !important;
}
html.theme-dark .hire-creator-sec .table tbody tr td a.invite-button-clr {
    background: transparent !important;
    color: var(--mm-brand) !important;
}
html.theme-dark .hire-creator-sec .table tbody tr td span.cat-tag {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text-muted) !important;
}

html.theme-dark .project-details .proposal,
html.theme-dark .project-details .your-proposal .content {
    /* These cards sit INSIDE the .wrapper panel, which is itself
     * --mm-surface-1. Painting the cards the same surface-1 made the
     * whole proposals section read as one flat dark slab. Lift the
     * cards to --mm-surface-2 (the "elevated card" tier) so they sit a
     * step above the panel and read as distinct cards. */
    background: var(--mm-surface-2) !important;
    border: 1px solid var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .project-details .proposal .title,
html.theme-dark .project-details .your-proposal .head .title {
    color: var(--mm-text) !important;
}
html.theme-dark .project-details .proposal .description,
html.theme-dark .project-details .proposal .description span,
html.theme-dark .project-details .your-proposal .content .description {
    /* Cover-letter body — was --mm-text-muted (82%) and read too dim
     * against the card. Full white for comfortable reading. */
    color: var(--mm-text) !important;
}
html.theme-dark .project-details .proposal .profile-box .name a,
html.theme-dark .project-details .proposal .profile-box .name,
html.theme-dark .project-details .proposal .profile-box h4 {
    color: var(--mm-text) !important;
}
html.theme-dark .project-details .proposal .profile-box .sub-content p {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .project-details .proposal .profile-box .sub-content span {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .project-details .proposal .profile-box .profile-img .online-status {
    /* Ring around the online dot — matches the card surface it sits on. */
    border-color: var(--mm-surface-2);
}
/* Category chip (the `Premium Explainer Video` pill) — pinned to a
 * near-white #F5F6F6 fill with grey text. Dark surface + white text.
 * Excludes `.category.attachment`: that variant shares the .category /
 * .cat-item classes but its items are meant to be plain transparent
 * text (an attachment filename, not a chip). */
html.theme-dark .project-details .category:not(.attachment) .cat-all-items .cat-item {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
    border: 1px solid var(--mm-border);
}
/* Attachment list items — keep them flush, no chip background. */
html.theme-dark .project-details .category.attachment .cat-all-items .cat-item {
    background: transparent !important;
    border: 0 !important;
    color: var(--mm-text) !important;
}
/* Proposal status pills (`Active` / `Cancelled` / `Pending`). The light
 * pastel tints (#E4F6E4 / #F6ECE4 / #F6F6E4) read as half-lit chips on
 * the dark card — repoint each to the dark-mode soft-tint + accent. */
html.theme-dark .project-details .proposal .profile-box .proposal-status .status-custom-button {
    background: var(--mm-warning-soft) !important;
    color: var(--mm-warning) !important;
}
html.theme-dark .project-details .proposal .profile-box .proposal-status .status-custom-button.Completed,
html.theme-dark .project-details .proposal .profile-box .proposal-status .status-custom-button.Ongoing,
html.theme-dark .project-details .proposal .profile-box .proposal-status .status-custom-button.Active {
    background: var(--mm-success-soft) !important;
    color: var(--mm-success) !important;
}
html.theme-dark .project-details .proposal .profile-box .proposal-status .status-custom-button.Cancelled {
    background: var(--mm-danger-soft) !important;
    color: var(--mm-danger) !important;
}
/* Project-chat send button — Send.svg is a flat <img> filled with the
 * deep brand purple #54387F, low-contrast on the dark composer.
 * Brighten the ACTIVE button only (the :disabled state keeps its own
 * grayscale/opacity grey-out). `src*=` not `src$=` — the file loads
 * with a ?v= cache-buster query, so an ends-with match misses it. */
html.theme-dark .send-btn:not(:disabled) img[src*="Send.svg"] {
    /* !important — the chat JS sets the img's filter inline (none when
     * active, a grey-out when disabled), and inline beats a plain rule. */
    filter: brightness(1.8) !important;
}
/* Message-edit cancel (✕) icon — the inline SVG is filled a muddy dark
 * red (#CF1A1A) that sits heavy on the dark composer; CSS `fill`
 * outranks the attribute. Lift it to the brighter dark-mode danger. */
html.theme-dark #closeButton path {
    fill: var(--mm-danger);
}

/* Back button — back.svg is a white square + navy arrow <img>. invert
 * flips the white square dark; grayscale neutralises the arrow (navy
 * inverts to a warm tan otherwise) so it reads as a clean light arrow.
 * invert(0.85) lands the square on a dark-grey surface rather than the
 * pure black a full invert gives, so it doesn't read as a hole. */
html.theme-dark img[src$="back.svg"] {
    filter: invert(0.85) grayscale(1);
}
/* Project-listing edit/delete icons (project/posted, project/new_projects).
 * edit.svg strokes #5B5876 and trash.svg fills currentColor (black) —
 * both near-invisible on dark. brightness(0) flattens any colour to
 * black, then invert(0.8) lifts it to a clear light-grey. */
html.theme-dark .edit-button {
    filter: brightness(0) invert(0.8);
}
/* Brief-edit floating panel (admin/PM inline-edit on /project/detail).
 * The panel itself uses a hard-coded `#fafbfc` outer surface + `#fff`
 * inner textarea / file chips. Both need explicit dark equivalents so
 * the editor doesn't fall back to a near-white island on dark. */
html.theme-dark .brief-edit-panel {
    background: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text);
}
html.theme-dark .brief-edit-label {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .brief-edit-textarea,
html.theme-dark .brief-edit-panel #project_files_list li,
html.theme-dark .brief-edit-panel .file-label {
    background: var(--mm-surface-input) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}

/* ---------- /project/detail (detail.php) inline-<style> dividers ----
 * detail.php's inline <style> hard-codes #E8EFF6 / #EEF0F2 (the light
 * --line) on the member-chip frame and the collapse-panel dividers.
 * On dark those flare up as bright white lines/outlines. Sweep them to
 * --mm-border. (The per-role chip OUTLINE colours are inline styles,
 * fixed at their source in detail.php.) */
html.theme-dark #myTags {
    border-color: var(--mm-border);
}
html.theme-dark .heading-border {
    border-top-color: var(--mm-border);
}
/* Divider above the job-detail panel (.main-content border-top, pinned
 * to the light #E8EFF6) — drop to the faint --mm-divider so it reads as
 * a hairline, not a bright rule. */
html.theme-dark .main-content {
    border-top-color: var(--mm-divider) !important;
}

/* Update Deadline modal (detail.php `.ud-*`). The modal shell is
 * already dark via the generic .modal-content rule, but every inner
 * control — label, the date-input wrap, the reason select, the Cancel
 * button — is hard-coded light. Theme them here. */
html.theme-dark .ud-modal .modal-title,
html.theme-dark .ud-label {
    color: var(--mm-text) !important;
}
html.theme-dark .ud-input-wrap {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .ud-input-wrap input,
html.theme-dark .ud-input-wrap input[type="date"],
html.theme-dark .ud-input-wrap input[type="text"],
html.theme-dark .ud-dropdown-text {
    color: var(--mm-text) !important;
    background: transparent !important;
}
html.theme-dark .ud-btn-cancel {
    background: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
/* While submitting, the Update button is disabled and the legacy rule
 * swaps it to a pale-pink (#F6B3AA) — washed-out and wrong on dark.
 * Keep it a recognisably dimmed brand orange instead. */
html.theme-dark .ud-btn-update:disabled {
    background: var(--mm-brand) !important;
    color: #fff !important;
    opacity: 0.5 !important;
}
/* Reason custom-dropdown — the closed control, the open list, its rows */
html.theme-dark .ud-dropdown-selected {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .ud-dropdown-selected svg path {
    stroke: var(--mm-text);
}
html.theme-dark .ud-dropdown-list {
    background: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .ud-dropdown-list li {
    color: var(--mm-text) !important;
}
html.theme-dark .ud-dropdown-list li:hover {
    background: var(--mm-surface-hover) !important;
}
html.theme-dark .ud-dropdown-list li.is-selected {
    color: var(--mm-brand) !important;
}

/* Delete-message confirmation modal (#messageModal). The card is a
 * hard-coded white .big-modal-content; the title/body <h3> carry inline
 * navy/grey colours and the Cancel button is light #ECECEC. Theme the
 * card, the (non-!important) inline text, and the Cancel button. */
html.theme-dark #messageModal .big-modal-content {
    background-color: var(--mm-surface-2) !important;
}
html.theme-dark #messageModal h3,
html.theme-dark #messageModal .modal-title,
html.theme-dark #messageModal .close-button {
    color: var(--mm-text) !important;
}
html.theme-dark #messageModal .modal-title {
    border-bottom-color: var(--mm-border) !important;
}
html.theme-dark #messageModal .modal-footer .cancel-btn {
    background-color: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .Chat-main .collaps-main .milestone_detail,
html.theme-dark .Chat-main .collaps-main .card {
    border-color: var(--mm-border) !important;
}
/* Mobile milestone cards (project detail) — `.table-mobile-data` ships
 * a hard #FFFFFF background. On dark it should merge into the panel
 * behind it (no grey slab), so drop the fill to transparent and keep
 * only a faint bottom divider between milestones. */
html.theme-dark .table-mobile-data {
    background: transparent !important;
    border-bottom-color: var(--mm-border) !important;
}
html.theme-dark .milestone_detail-mobile p {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .milestone_detail-mobile .t-data,
html.theme-dark .milestone_detail-mobile .t-data .amount {
    color: var(--mm-text) !important;
}
/* Desktop milestone table — the cell text (.mm-table-cd-milestone td)
 * is navy #2D405A and the amount value #5B5876, both near-invisible on
 * the dark panel. Lift them to white. */
html.theme-dark .mm-table-cd-milestone td,
html.theme-dark .Chat-main .collaps-main .collapsed-details .milestone_detail .amount {
    color: var(--mm-text) !important;
}

/* ---------- Create Project form (/project/add) ----------
 * assets/front/addProject.css is a page-specific stylesheet full of
 * hard-coded light values: a white `.project-form` card, `#FFF` inputs
 * with `#DDE1E5` borders, white-bordered Select2 widgets. None of it is
 * theme-aware, so the form rendered as a white card studded with light
 * controls on the dark page. Re-point every surface here. addProject.css
 * loads after this file, but the `html.theme-dark` prefix out-ranks its
 * plain (and !important) selectors. */
html.theme-dark .project-form {
    /* Flush to the page background with just a 1px outline — painting
     * the card a lighter --mm-surface-1 left visible lighter bands down
     * the left/right edges (the card padding showing through). The user
     * wants only an outline, no coloured edge. */
    background-color: var(--mm-bg) !important;
    border: 1px solid var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .project-form .title {
    color: var(--mm-text) !important;
}
html.theme-dark .project-form .form-txt {
    color: var(--mm-text-muted);
}
html.theme-dark .project-form .btn-secondary {
    background-color: var(--mm-surface-2);
    color: var(--mm-text);
}
/* Text inputs, selects, and the `.plc` pseudo-select display boxes */
html.theme-dark .project-form input,
html.theme-dark .project-form textarea,
html.theme-dark .project-form .form-control,
html.theme-dark .project-form input[type="number"],
html.theme-dark .project-form input[type="text"],
html.theme-dark .project-form .plc {
    background: var(--mm-surface-input) !important;
    border: 1px solid var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .project-form input::placeholder,
html.theme-dark .project-form textarea::placeholder {
    color: var(--mm-text-faint);
}
/* Native date picker indicator is black-on-black otherwise */
html.theme-dark .project-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}
/* Chrome autofill paints its own light background (the Budget field
 * showed up as a mid-grey slab) — pin it back to the input surface. */
html.theme-dark .project-form input:-webkit-autofill,
html.theme-dark .project-form input:-webkit-autofill:hover,
html.theme-dark .project-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--mm-text);
    -webkit-box-shadow: 0 0 0 1000px var(--mm-surface-input) inset;
    caret-color: var(--mm-text);
}
/* File-picker label chip */
html.theme-dark .project-form .file-label {
    background-color: var(--mm-surface-2) !important;
    color: var(--mm-text);
}
/* "Add another job" + button — a full-width #FDF5F4 (light pink) bar.
 * Dark surface; keep the brand-orange plus glyph. */
html.theme-dark .project-form .plus-btn {
    background-color: var(--mm-surface-2) !important;
}
/* Per-job "remove" (−) circle button — a light #FDF5F4 pill. */
html.theme-dark .job-remove-btn {
    background-color: var(--mm-surface-2) !important;
}
html.theme-dark .job-remove-btn:hover {
    background-color: var(--mm-surface-hover) !important;
}
/* Select2 multi-select selected chips (Admin/Cc Customers) */
html.theme-dark .select2-selection__choice {
    background-color: var(--mm-surface-3) !important;
    border: 1px solid var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .select2-selection__choice,
html.theme-dark .select2-selection__choice * {
    color: var(--mm-text) !important;
}
html.theme-dark .select2-selection__choice__remove {
    color: var(--mm-text-muted) !important;
}
/* Select2 single + multi controls, dropdown panel, search field */
html.theme-dark .select2-selection--single,
html.theme-dark .select2-selection--multiple,
html.theme-dark .select2-dropdown,
html.theme-dark .select2-container--open .select2-dropdown,
html.theme-dark .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--mm-surface-input) !important;
    border: 1px solid var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--mm-text);
}
/* The rendered value box inside a single-select carries its own light
 * fill on some pages (e.g. Edit Job's Category #F4F6F9) — let the dark
 * .select2-selection surface show through. */
html.theme-dark .select2-selection__rendered {
    background: transparent !important;
}
/* Project-listing STATUS dropdown (a select2 inside .table.dataTable).
 * Light-mode design: a borderless .select2-selection--single whose
 * .select2-selection__rendered IS the full-width bordered pill (the
 * arrow overlays its right edge). Mirror that on dark — drop the outer
 * border the global select2 fix adds, give the rendered pill a subtle
 * dark border. (The Edit-Job Category fix below is scoped to
 * .form-group so it can't bleed flex/height onto this table dropdown,
 * which is what shrank the pill and detached the chevron.) */
html.theme-dark .table.dataTable .select2-selection--single {
    border: 0 !important;
}
html.theme-dark .table.dataTable .select2-selection__rendered {
    border: 1px solid var(--mm-border) !important;
    /* style.css pins this to #5B5876 (dark purple) with !important. */
    color: var(--mm-text) !important;
}
/* FORM Category/select2 single-selects (Edit Job etc.) — scoped to
 * .form-group so it does NOT touch the table status dropdown above.
 * Edit Job's inline <style> zeroes the select2 border and its rendered
 * value box overflows the short control; restore a 1px border, size
 * the control to the sibling-input height, centre value + chevron. */
html.theme-dark .form-group span.select2-selection.select2-selection--single {
    border: 1px solid var(--mm-border) !important;
}
html.theme-dark .form-group .select2-selection--single {
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
}
html.theme-dark .form-group .select2-selection--single .select2-selection__rendered {
    height: auto !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: normal !important;
}
html.theme-dark .form-group .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    top: 0 !important;
}
/* Select2 multi-select INLINE search field. addProject.css's broad
 * `.project-form input` rule frames every input with a border, an 8px
 * radius and 13px padding — including the tiny typing input inside a
 * multi-select, which then renders as a stray rounded "blob" in an
 * otherwise-empty Admin/Cc Customers control. Reset it flush. */
html.theme-dark .select2-search--inline .select2-search__field {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    color: var(--mm-text) !important;
}
html.theme-dark .select2-results__option {
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text);
}
html.theme-dark .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--mm-surface-2) !important;
}
/* Dropdown user rows (addProject.css pins these to black) */
html.theme-dark .user-div .user-info > p,
html.theme-dark .user-div .user-info > span {
    color: var(--mm-text);
}

/* ---------- Sales pages (/sales, /sales/team, assets/css/pages/sales.css)
 * sales.css re-declares its whole design-token set LOCALLY on `.mm-app`
 * (--bg-card, --ink-*, --border, --primary, --purple, …). Because those
 * land on `.mm-app` itself — a descendant of <html> — they shadow the
 * global `html.theme-dark` token remap for the entire sales subtree, so
 * the page stayed fully light in dark mode. Re-point the same token set
 * here under `html.theme-dark .mm-app` (specificity 0,2,1 beats the
 * plain `.mm-app` block) to flip every sales surface at once. */
html.theme-dark .mm-app {
    --bg-page:        var(--mm-bg);
    --bg-card:        var(--mm-surface-1);
    --bg-soft:        var(--mm-surface-2);
    --bg-softer:      var(--mm-surface-2);

    --ink-900:        var(--mm-text);
    --ink-700:        rgba(255, 255, 255, 0.95);
    --ink-500:        rgba(255, 255, 255, 0.82);
    --ink-400:        rgba(255, 255, 255, 0.68);
    --ink-300:        rgba(255, 255, 255, 0.55);

    --border:         var(--mm-border);
    --border-strong:  var(--mm-border-strong);

    --primary:        var(--mm-brand);
    --primary-tint:   var(--mm-brand-soft);
    --primary-tint-2: rgba(255, 107, 71, 0.20);

    --purple:         #b89cf0;
    --purple-tint:    rgba(180, 156, 240, 0.18);
    --purple-tint-2:  rgba(180, 156, 240, 0.28);

    --warn-tint:      rgba(255, 255, 255, 0.06);

    --mm-shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
    --mm-shadow:      0 6px 24px -8px rgba(0, 0, 0, 0.6);
}
/* `.filter-chip--active` fills its background with --ink-900 (the active
 * "All / Full Time / Freelance" pill). With --ink-900 now flipped to
 * white that fill would go white-on-white — repoint it to an elevated
 * surface so the selected chip still reads as filled. */
html.theme-dark .mm-app .filter-chip--active {
    background: var(--mm-surface-3);
    border-color: var(--mm-surface-3);
}
/* Salesperson-name links: dark-mode.css's blanket `html.theme-dark
 * a:visited` rule (0,2,2) out-ranks sales.css's `.mm-app a.sp-name`
 * (0,2,1), so a row whose drill-down had been opened turned brand
 * orange on its own. A 3-class rule out-ranks :visited; hover still
 * gets the intentional brand colour. */
html.theme-dark .mm-app a.sp-name {
    color: var(--mm-text);
}
html.theme-dark .mm-app a.sp-name:hover {
    color: var(--mm-brand);
}

/* ---------- Profile pages (manager + customer + creator) ----------
 * The manager profile view uses its own card classes (`.left-profile`,
 * `.right-profile`, `.right-profile.protfolio`) hard-coded to white
 * with `background: #FFFFFF !important` at the top of profile.php.
 * The `.new-form .new-input*` form-control wrappers carry the same
 * pattern. Match the override scope so every profile / edit surface
 * inherits the dark surface treatment.
 *
 * Also covers /user/edit_profile, /user/view_profile, and the customer
 * profile partials. */
html.theme-dark .left-profile,
html.theme-dark .right-profile,
html.theme-dark .right-profile.protfolio,
html.theme-dark .profile-info,
html.theme-dark .profile-card,
html.theme-dark .pro-info-box,
html.theme-dark .rp-confirm-modal,
html.theme-dark .rp-confirm-item {
    background-color: var(--mm-surface-1) !important;
    color: var(--mm-text);
    border: 1px solid var(--mm-border);
    box-shadow: var(--mm-shadow-1);
}
/* Profile name + meta text colors */
html.theme-dark .left-profile h2,
html.theme-dark .left-profile h3,
html.theme-dark .left-profile h4,
html.theme-dark .right-profile h2,
html.theme-dark .right-profile h3,
html.theme-dark .right-profile h4 {
    color: var(--mm-text);
}
html.theme-dark .left-profile p,
html.theme-dark .right-profile p {
    color: var(--mm-text-muted);
}
/* Expertise chips on the manager profile (`.right-profile .info .item`
 * + the older `.badge` variant). profile.php pins
 * `.ProfilePageNew .right-profile .info .item { background: #F5F6F6 }`,
 * which becomes white-text-on-near-white on dark — invisible. */
html.theme-dark .right-profile .badge,
html.theme-dark .right-profile .expertise-pill,
html.theme-dark .ProfilePageNew .right-profile .info .item,
html.theme-dark .ProfilePageNew .right-profile .info .item p {
    background-color: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .ProfilePageNew .right-profile .info .item p {
    background-color: transparent !important;
}
/* The .new-form form-control wrappers — they pin
 * `background: #FFFFFF !important` on every input variant. */
html.theme-dark .new-form .new-input,
html.theme-dark .new-form .new-input2,
html.theme-dark .new-form .new-input3,
html.theme-dark .new-form .new-input4,
html.theme-dark .new-form .new-input10,
html.theme-dark .new-form .new-input21,
html.theme-dark .new-form .select2-selection--multiple,
html.theme-dark .new-form .new-input10 .pass-input {
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .new-form .gj-datepicker-bootstrap .btn {
    background-color: var(--mm-surface-2) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
/* The manager-profile About editor textarea (#description) pins a
 * near-white #DDE1E5 border that reads as a glaring outline on dark. */
html.theme-dark .new-form #description,
html.theme-dark .new-form textarea.form-control {
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
/* Add/Edit-portfolio modal inputs (view_profile.php) — style.css pins
 * `#addPortfolioForm .form-control` (+ edit/withdrawal variants) to a
 * glaring `2px solid #f4f6f9` border. The id in the page selector
 * outranks the generic dark `.form-control` rule, so re-scope with the
 * id to win. The .dragBox upload zone's #d2d4d6 dashed border is
 * dimmed to match. */
html.theme-dark #addPortfolioForm .form-control,
html.theme-dark #editPortfolioForm .form-control,
html.theme-dark #widthdrawalEdit .form-control {
    border: 1px solid var(--mm-border) !important;
}
html.theme-dark .dragBox {
    border-color: var(--mm-border-strong) !important;
}
/* The portfolio "+" add button uses the light-mode brand orange
 * (#EF5537), which reads dim on the dark card. Lift it to the brighter
 * dark-mode brand orange so it stands out. */
html.theme-dark .UploadIcon-Container {
    color: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
}
/* The .new-form Cancel button (.new-btn2) is a white-fill outline
 * button — the white slab glares on dark. Drop the fill so it reads
 * as the intended orange outline button. */
html.theme-dark .new-form .new-btn2 {
    background: transparent !important;
}

/* ---------- Add / Edit portfolio page (manager/addProtfolio.php,
 * editProtfolio.php). The page <style> pins .add-block to #FFFFFF, its
 * text/file inputs to a white fill at opacity:0.5, the file-picker
 * label to #F5F5F5, and the #thumbimg preview box to a light border. */
html.theme-dark .add-block {
    background: var(--mm-surface-1) !important;
    border: 1px solid var(--mm-border);
}
html.theme-dark .add-block input:not([type="submit"]):not([type="button"]) {
    background: var(--mm-surface-input) !important;
    opacity: 1 !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .add-block .custom-file-button label {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .add-block #thumbimg {
    border-color: var(--mm-border) !important;
    box-shadow: none !important;
}
/* The file-picker row nests a Bootstrap `.container` inside the card;
 * the blanket dark `.container` rule paints it the page bg (#121212),
 * so it reads as a near-black box-in-a-box. Keep it transparent. */
html.theme-dark .add-block .container {
    background: transparent !important;
}
/* The file-input half of the picker (#inputGroupFile) carries a 1px
 * border + its own --mm-surface-input fill that the card does not, so
 * it reads as a stray outline + a lighter block around the filename.
 * Strip both so only the "Choose thumbnail" label chip stands out.
 * (Selector uses the id to outrank the .add-block input fill rule.) */
html.theme-dark .add-block input#inputGroupFile {
    border: none !important;
    background: transparent !important;
}
/* TinyMCE editor chrome — the oxide-dark skin is navy (#222f3e). Repaint
 * the menubar / toolbar / statusbar and the bespoke style dropdowns to
 * the app's neutral charcoal so the editor blends with the dark page.
 * (The iframe body is recoloured via content_style in tinymce.init.) */
html.theme-dark .tox-tinymce {
    border-color: var(--mm-border) !important;
}
html.theme-dark .tox .tox-editor-header,
html.theme-dark .tox .tox-menubar,
html.theme-dark .tox .tox-toolbar,
html.theme-dark .tox .tox-toolbar__primary,
html.theme-dark .tox .tox-toolbar__overflow,
html.theme-dark .tox .tox-toolbar-overlord,
html.theme-dark .tox .tox-statusbar {
    background-color: var(--mm-surface-2) !important;
}
/* The "…" overflow toolbar pops up in the floating .tox-tinymce-aux
 * container; recolour its border so it doesn't keep the oxide navy. */
html.theme-dark .tox .tox-toolbar__overflow {
    border-color: var(--mm-border) !important;
}
html.theme-dark .tox .tox-edit-area__iframe {
    background-color: var(--mm-surface-1) !important;
}
html.theme-dark .tox .tox-tbtn--bespoke {
    background-color: var(--mm-surface-input) !important;
}
/* TinyMCE menus + button states — the dropdown panels (File/Format/…)
 * render in a separate .tox-tinymce-aux container that the chrome
 * rules above don't reach, so they stay oxide-dark navy, and the
 * active/hover highlight is oxide's blue. Recolor the panels to the
 * app charcoal and the highlight to a neutral hover. */
html.theme-dark .tox .tox-menu,
html.theme-dark .tox .tox-collection--list,
html.theme-dark .tox .tox-collection--grid {
    background-color: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .tox .tox-collection__group {
    border-color: var(--mm-border) !important;
}
html.theme-dark .tox .tox-collection__item--active,
html.theme-dark .tox .tox-collection__item--enabled,
html.theme-dark .tox .tox-mbtn--active,
html.theme-dark .tox .tox-mbtn:hover,
html.theme-dark .tox .tox-tbtn:hover,
html.theme-dark .tox .tox-tbtn--enabled {
    background-color: var(--mm-surface-hover) !important;
}

/* ---------- Creator profile (/user/profile/<username>, view_profile.php)
 * The summary card shell is `.fr-c-detail-box` and the stats block below
 * it `.fr-ca-more-details`. Several inner pieces are hard-coded light:
 *   - `.fl-profile-img` is the avatar frame, pinned to a white fill.
 *   - `.thick-font` is the "4.7" rating, the Ongoing/Completed/Member-Since
 *     values, and each per-review rating — all #000.
 *   - the category chips `ul.skills li.skill-detail-li a` use a near-white
 *     #F5F6F6 fill with grey text — invisible on dark.
 *   - `.Review-Doller` is the per-review price, also #000.
 *   - each review row `.ReviEws` carries a near-white #E8EFF6 top border
 *     that glows on the dark background.
 * (The "i" popover button's inline #f8f9fa span fill + #78808A text are
 *  fixed in view_profile.php itself with var() fallbacks — an inline
 *  !important can't be beaten from a stylesheet.) */
html.theme-dark .fl-profile-img {
    background: transparent !important;
    box-shadow: none !important;
}
html.theme-dark .fr-c-detail-box .thick-font,
html.theme-dark .fr-ca-more-details .thick-font,
html.theme-dark .Review-Rating .thick-font,
html.theme-dark .Review-Doller {
    color: var(--mm-text) !important;
}
html.theme-dark ul.skills li.skill-detail-li a {
    background-color: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .ReviEws {
    border-top-color: var(--mm-border) !important;
}
/* The review job titles are brand-orange in light mode; the blanket
 * `.page-template h6` dark rule (specificity 0,2,2) repaints them
 * white. Match its `.page-template` scope so this wins on specificity
 * (0,3,1) and keeps them orange on dark. */
html.theme-dark .page-template .Review-Explain {
    color: var(--mm-brand) !important;
}
/* Manager profile (/user/manager/<username>, manager/profile.php) — its
 * page <style> pins `.thick-font` to #000 and `.ProfilePageNew .info
 * span` to #000000, so the rating value and the Ongoing/Completed/
 * Member-Since numbers render black on the dark card. (The "i" popover
 * button's inline span fill + text are fixed in profile.php itself.) */
html.theme-dark .left-profile .thick-font,
html.theme-dark .ProfilePageNew .info span {
    color: var(--mm-text) !important;
}
/* Manager profile review list (.right-profile .review-item) — page CSS
 * pins the title to #EF5537 (then repainted white by the blanket dark
 * `.right-profile p` rule), the .span rating value to #000, the date
 * .review-count2 to #56606D, and a near-white #E8EFF6 bottom-border
 * separator that glows on dark. Keep the title brand-orange to match
 * the creator profile. */
html.theme-dark .right-profile .review-item {
    border-bottom-color: var(--mm-border) !important;
}
html.theme-dark .right-profile .review-item .title {
    color: var(--mm-brand) !important;
}
html.theme-dark .right-profile .review-item .span {
    color: var(--mm-text) !important;
}
html.theme-dark .right-profile .review-item .review-count2 {
    color: var(--mm-text-muted) !important;
}
/* The row separators (.row-section) and section-title underlines
 * (.right-profile .header) use a near-white #E8EFF6 border that glows
 * on dark. Dim them to --mm-border to match the card outlines. */
html.theme-dark .row-section,
html.theme-dark .right-profile .header {
    border-bottom-color: var(--mm-border) !important;
}
/* The review-detail popup (.modal-rating) — the rating value next to
 * the stars is a .span pinned #000 by page CSS, invisible on the dark
 * modal surface. */
html.theme-dark .modal-rating .span {
    color: var(--mm-text) !important;
}
/* Personal-Information row icons — the withdrawal + password-reset
 * tiles had 0.12-opacity fills that read dim on the dark card (the
 * tile opacity was raised to 0.25 in the SVGs themselves, since a CSS
 * filter can't add alpha to a translucent fill). A small brightness
 * lift on dark gives the glyphs a touch more pop. */
html.theme-dark .icon-section img[src*="withdrawal-icon"],
html.theme-dark .icon-section img[src*="group-36522"] {
    filter: brightness(1.18);
}

/* Project / job tiles */
html.theme-dark .project_box,
html.theme-dark .project_card,
html.theme-dark .job_box,
html.theme-dark .task_box,
html.theme-dark .creator_box,
html.theme-dark .manager_box,
html.theme-dark .cust_box,
html.theme-dark .post-card,
html.theme-dark .feature-card,
html.theme-dark .item-card {
    background-color: var(--mm-surface-1) !important;
    color: var(--mm-text);
    border-color: var(--mm-border);
    box-shadow: var(--mm-shadow-1);
}
html.theme-dark .project_box .title,
html.theme-dark .project_box h3,
html.theme-dark .project_box h4,
html.theme-dark .job_box .title,
html.theme-dark .task_box .title {
    color: var(--mm-text);
}

/* Status pills: keep semantic colors but ensure readable text */
html.theme-dark .status-pill,
html.theme-dark .badge-status,
html.theme-dark .label,
html.theme-dark .pill {
    color: #fff;
}

/* Loader overlay — page-template loader uses white bg */
html.theme-dark .loader-outer {
    background-color: rgba(0, 0, 0, 0.6) !important;
}

/* Footer */
html.theme-dark footer,
html.theme-dark .footer,
html.theme-dark .site-footer {
    background-color: var(--mm-surface-1) !important;
    color: var(--mm-text);
    border-top: 1px solid var(--mm-border);
}


/* ----------------------------------------------------------------------------
   5. Third-party widgets
   ---------------------------------------------------------------------------- */

/* SweetAlert2 (mm-dialog brand layer riding on top) */
html.theme-dark .swal2-popup,
html.theme-dark .mm-dialog {
    background-color: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .swal2-popup .swal2-title,
html.theme-dark .swal2-popup .swal2-content,
html.theme-dark .swal2-popup .swal2-html-container,
html.theme-dark .mm-dialog .swal2-title,
html.theme-dark .mm-dialog .swal2-content,
html.theme-dark .mm-dialog .swal2-html-container {
    color: var(--mm-text) !important;
}
html.theme-dark .swal2-container.swal2-shown {
    background-color: rgba(0, 0, 0, 0.65) !important;
}
html.theme-dark .swal2-input,
html.theme-dark .swal2-textarea,
html.theme-dark .swal2-select,
html.theme-dark .swal2-file {
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .swal2-styled.swal2-cancel {
    background-color: var(--mm-surface-2) !important;
    color: var(--mm-text) !important;
}
/* mm-dialog (SweetAlert2 brand layer). Every --mm-dialog-* token is
 * tuned for a white popup — the ink colours go near-black, the warn /
 * danger / success backgrounds are pale tints, the lines are light
 * greys. Retune the whole token set for dark mode; the mm-dialog.css
 * rules read these vars, so this needs no specificity fight. */
html.theme-dark .swal2-popup.mm-dialog,
html.theme-dark .swal2-popup.mm-dialog.swal2-modal {
    --mm-dialog-primary: var(--mm-brand);
    --mm-dialog-primary-hover: var(--mm-brand-hover);
    --mm-dialog-ink-900: var(--mm-text);
    --mm-dialog-ink-700: var(--mm-text-muted);
    --mm-dialog-line: var(--mm-border);
    --mm-dialog-line-2: var(--mm-border-strong);
    --mm-dialog-soft: var(--mm-surface-2);
    --mm-dialog-warn: var(--mm-warning);
    --mm-dialog-warn-bg: var(--mm-warning-soft);
    --mm-dialog-danger: var(--mm-warning);
    --mm-dialog-danger-bg: var(--mm-warning-soft);
    --mm-dialog-success: var(--mm-success);
    --mm-dialog-success-bg: transparent;
}
/* The ghost Cancel button hard-codes `background:#fff` (not a token),
 * so the retune above can't reach it — it stayed a bright white slab.
 * Make it a true ghost on dark: transparent fill, themed border/text
 * (those DO come from the retuned tokens), surface fill on hover. */
html.theme-dark .swal2-popup.mm-dialog .swal2-styled.swal2-cancel {
    background-color: transparent !important;
}
html.theme-dark .swal2-popup.mm-dialog .swal2-styled.swal2-cancel:hover,
html.theme-dark .swal2-popup.mm-dialog .swal2-styled.swal2-cancel:focus {
    background-color: var(--mm-surface-2) !important;
}
/* Ring border: the token above zeroes it out, so set a visible green
 * ring explicitly (out-specifies mm-dialog.css's 0,5,0 rule). */
html.theme-dark .swal2-popup.mm-dialog .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(74, 222, 128, 0.5) !important;
}
/* The circular-line masks and the "fix" wedge are hard-painted white in
 * Swal v10 to blend into a white popup — on the dark popup they show as
 * a white slash across the ring, and the rotating wedge sweeps a white
 * flash during the reveal animation. Repaint them to the popup surface
 * so they stay invisible. */
html.theme-dark .swal2-icon.swal2-success .swal2-success-circular-line-left,
html.theme-dark .swal2-icon.swal2-success .swal2-success-circular-line-right,
html.theme-dark .swal2-icon.swal2-success .swal2-success-fix {
    background-color: var(--mm-surface-3) !important;
}

/* DataTables */
html.theme-dark .dataTables_wrapper,
html.theme-dark .dataTables_wrapper .dataTables_length,
html.theme-dark .dataTables_wrapper .dataTables_filter,
html.theme-dark .dataTables_wrapper .dataTables_info,
html.theme-dark .dataTables_wrapper .dataTables_processing,
html.theme-dark .dataTables_wrapper .dataTables_paginate {
    color: var(--mm-text);
}
/* Light-mode pagination is text-only: each .paginate_button is plain
 * text; .current and :hover just flip the colour to #EF5537. No fill,
 * no border. Mirror that on dark — drop the previous filled / bordered
 * treatment that introduced a chunky highlight light mode never had. */
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--mm-text) !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: transparent !important;
    color: var(--mm-brand) !important;
    border: 0 !important;
    box-shadow: none !important;
}
html.theme-dark table.dataTable thead th,
html.theme-dark table.dataTable thead td,
html.theme-dark table.dataTable tfoot th,
html.theme-dark table.dataTable tfoot td {
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark table.dataTable tbody tr {
    background-color: var(--mm-surface-1);
}
html.theme-dark table.dataTable.stripe tbody tr.odd,
html.theme-dark table.dataTable.display tbody tr.odd {
    background-color: rgba(255, 255, 255, 0.03);
}
html.theme-dark table.dataTable.hover tbody tr:hover,
html.theme-dark table.dataTable.display tbody tr:hover {
    background-color: var(--mm-surface-hover);
}
/* mm-table-users (Creators / Managers / sub-admin client-side
 * DataTables) + the DataTables chrome — the page CSS pins the "Show
 * entries" label, the "No data" cell, the header rule and the length
 * select all to dark navy / light hairlines, unreadable on dark. */
html.theme-dark .mm-table-users thead th,
html.theme-dark .mm-table-users thead td {
    border-bottom-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .mm-table-users tbody td {
    color: var(--mm-text-muted) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .dataTables_length label,
html.theme-dark .dataTables_length {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .dataTables_length select {
    border-color: var(--mm-border) !important;
}
html.theme-dark td.dataTables_empty,
html.theme-dark .dataTables_empty {
    color: var(--mm-text-muted) !important;
    border-bottom-color: var(--mm-border) !important;
}

/* jQuery UI (datepicker, autocomplete) */
html.theme-dark .ui-widget.ui-widget-content,
html.theme-dark .ui-datepicker,
html.theme-dark .ui-autocomplete,
html.theme-dark .ui-menu {
    background: var(--mm-surface-2);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .ui-widget-header,
html.theme-dark .ui-datepicker .ui-datepicker-header {
    background: var(--mm-surface-3);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .ui-state-default,
html.theme-dark .ui-widget-content .ui-state-default,
html.theme-dark .ui-datepicker td a {
    background: var(--mm-surface-1);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .ui-state-hover,
html.theme-dark .ui-state-active,
html.theme-dark .ui-widget-content .ui-state-hover,
html.theme-dark .ui-widget-content .ui-state-active {
    background: var(--mm-brand);
    color: #fff;
    border-color: var(--mm-brand);
}
html.theme-dark .ui-menu .ui-menu-item-wrapper {
    color: var(--mm-text);
}
html.theme-dark .ui-menu .ui-menu-item .ui-state-active {
    background: var(--mm-brand-soft);
    color: var(--mm-text);
    border: none;
}

/* Select2 */
html.theme-dark .select2-container--default .select2-selection--single,
html.theme-dark .select2-container--default .select2-selection--multiple {
    background-color: var(--mm-surface-input);
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--mm-text);
}
html.theme-dark .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--mm-text-faint);
}
html.theme-dark .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--mm-brand-soft);
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .select2-dropdown {
    background-color: var(--mm-surface-2);
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .select2-results__option {
    color: var(--mm-text);
}
html.theme-dark .select2-results__option--highlighted[aria-selected],
html.theme-dark .select2-container--default .select2-results__option--highlighted,
html.theme-dark .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--mm-brand) !important;
    color: #fff !important;
    /* Light-mode CSS gives the highlighted option `border-radius:4px`.
     * On the dark dropdown panel those rounded corners expose ~4px of
     * the panel surface to the left/right of the orange pill — read as
     * light "edges" against the bright brand fill. Drop the radius so
     * the highlight fills the panel edge-to-edge on dark. */
    border-radius: 0 !important;
}
/* The SELECTED (aria-selected=true) option that ISN'T currently being
 * hovered — light CSS gives it the same pale-pink fill as the
 * highlighted state. On dark that fill rendered as visible light
 * corners around the row ("white corners below Ongoing"). Show it
 * as orange text on the dark panel instead, no fill, no radius. The
 * highlighted rule above wins via specificity when the user hovers it. */
html.theme-dark .select2-container--default .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: transparent !important;
    color: var(--mm-brand) !important;
    border-radius: 0 !important;
}
/* Even with border-radius:0 on the highlight, the panel's 1px light
 * border (--mm-border, 0.12) still showed through as a thin frame
 * around the orange pill — read by users as "white corners". Clip the
 * panel and zero its outer border so the orange highlight is the only
 * thing visible at the panel's edges. */
html.theme-dark .select2-dropdown {
    border: 0 !important;
    overflow: hidden !important;
}
/* Select2 default CSS gives the inner .select2-results SPAN a white
 * background. The dark .select2-dropdown bg covers it only as long as
 * everything inside is opaque — once an option goes transparent (the
 * selected-not-hovered rule above), the white wrapper shows through.
 * Make it transparent so the dropdown's surface-input bg is what
 * shows. */
html.theme-dark .select2-results {
    background: transparent !important;
}

/* DataTables Buttons (`dom: 'Bfrtip', buttons: ['csv']`) — the rendered
 * markup is `<a class="btn btn-default buttons-csv buttons-html5">` and
 * Bootstrap's .btn-default + the dashboard theme gave it a flat black
 * fill on dark. Skin every export button as a brand-orange pill
 * matching the rest of the app's accent buttons.
 *
 * Scoped to the HTML5-export classes only — NOT a broad
 * `.dt-buttons .btn`. The wider selector also caught custom action
 * buttons that opt into .dt-buttons (e.g. `.back_buttton_custom` —
 * the "Navigate to Client Chat" text link on project/task), turning
 * a plain orange link into a filled pill it was never meant to be. */
html.theme-dark .buttons-html5,
html.theme-dark .buttons-csv {
    background: var(--mm-brand) !important;
    background-image: none !important;
    border: 1px solid var(--mm-brand) !important;
    border-radius: 8px !important;
    color: #fff !important;
    padding: 6px 14px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}
/* Users list (wpxo_user/user_list_server) — the "Edit" action link is
 * built in PHP with an inline `style="color:#5B5876"` (the light-mode
 * muted-purple td colour). That bakes the dim fill into the element
 * regardless of theme; on dark it sits on the dark row and reads as
 * an unclickable ghost. Override to brand orange — `tbody a` also
 * catches the "View profile" link in creators-mode so both action
 * links read consistently. */
html.theme-dark .users-table tbody a {
    color: var(--mm-brand) !important;
}

/* Member-chip remove buttons (.tagClose × glyph) in the project-chat
 * participants row. The page-scoped CSS only positions them; the
 * glyph inherits color and resolves to pure black on dark — invisible
 * against the dark chip fills. Pin to muted white; brighten on hover
 * so the removal action is discoverable. */
html.theme-dark .tags-input .tag .tagClose {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .tags-input .tag .tagClose:hover,
html.theme-dark .tags-input .tag .tagClose:focus {
    color: var(--mm-text) !important;
}

html.theme-dark .buttons-html5:hover,
html.theme-dark .buttons-html5:focus,
html.theme-dark .buttons-csv:hover,
html.theme-dark .buttons-csv:focus {
    background: var(--mm-brand-hover) !important;
    border-color: var(--mm-brand-hover) !important;
    color: #fff !important;
}
html.theme-dark .select2-search--dropdown .select2-search__field {
    background-color: var(--mm-surface-input);
    color: var(--mm-text);
    border-color: var(--mm-border);
}

/* CKEditor 4 — the chrome around the editable iframe.
 *
 * The iframe's content body is dark-themed via mm-editor-theme.js + the
 * separate `assets/css/ck-editor-dark.css` (loaded by CKEditor's
 * `contentsCss`). Here we only style what lives in the host document:
 * the toolbar, dropdowns, dialog modals, and the iframe wrapper border.
 *
 * Selectors all use `.cke_*` which is CKEditor 4's class-naming
 * convention — those classes are kept stable across patch releases. */
html.theme-dark .cke,
html.theme-dark .cke_chrome,
html.theme-dark .cke_inner {
    background-color: var(--mm-surface-2);
    border-color: var(--mm-border);
}
html.theme-dark .cke_top,
html.theme-dark .cke_bottom {
    background-color: var(--mm-surface-3);
    border-color: var(--mm-border);
}
html.theme-dark .cke_toolbar,
html.theme-dark .cke_toolgroup {
    background-color: transparent;
    border-color: var(--mm-border);
}
html.theme-dark .cke_button {
    color: var(--mm-text);
}
html.theme-dark .cke_button .cke_button_icon {
    /* CKEditor's stock icons are dark-on-light sprites; invert them so they
     * render as light glyphs on dark toolbar surfaces. Hue-rotate keeps
     * coloured icons (e.g. the colour-picker) recognisable. */
    filter: invert(1) hue-rotate(180deg);
}
html.theme-dark .cke_button:hover,
html.theme-dark .cke_button:focus,
html.theme-dark .cke_button_on {
    background-color: var(--mm-surface-hover);
}
html.theme-dark .cke_combo_button,
html.theme-dark .cke_combo_text {
    color: var(--mm-text);
    background-color: transparent;
}
html.theme-dark .cke_combo_arrow {
    border-top-color: var(--mm-text);
}
html.theme-dark .cke_path_item,
html.theme-dark .cke_path_empty {
    color: var(--mm-text-muted);
}
html.theme-dark .cke_panel,
html.theme-dark .cke_dialog,
html.theme-dark .cke_dialog_body,
html.theme-dark .cke_dialog_contents,
html.theme-dark .cke_dialog_title,
html.theme-dark .cke_dialog_tabs,
html.theme-dark .cke_dialog_ui_input_text,
html.theme-dark .cke_dialog_ui_input_textarea {
    background-color: var(--mm-surface-2) !important;
    color: var(--mm-text) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .cke_dialog_ui_input_text,
html.theme-dark .cke_dialog_ui_input_textarea {
    background-color: var(--mm-surface-input) !important;
}
html.theme-dark .cke_dialog_close_button {
    color: var(--mm-text);
}

/* Trumbowyg WYSIWYG */
html.theme-dark .trumbowyg-box,
html.theme-dark .trumbowyg-editor {
    background-color: var(--mm-surface-input);
    color: var(--mm-text);
    border-color: var(--mm-border);
}
html.theme-dark .trumbowyg-button-pane {
    background-color: var(--mm-surface-2);
    border-bottom-color: var(--mm-border);
}
html.theme-dark .trumbowyg-button-pane button {
    color: var(--mm-text);
}
html.theme-dark .trumbowyg-button-pane button svg {
    fill: var(--mm-text);
}
html.theme-dark .trumbowyg-button-pane button:hover,
html.theme-dark .trumbowyg-button-pane button:focus,
html.theme-dark .trumbowyg-button-pane button.trumbowyg-active {
    background-color: var(--mm-surface-hover);
}
html.theme-dark .trumbowyg-modal-box {
    background-color: var(--mm-surface-3);
    color: var(--mm-text);
}

/* Croppie */
html.theme-dark .croppie-container .cr-overlay {
    box-shadow: 0 0 2000px 2000px rgba(0, 0, 0, 0.7);
}

/* Jcrop (simple-image-cropper) */
html.theme-dark .jcrop-holder {
    background-color: var(--mm-bg) !important;
}

/* mm-dialog (brand layer over SweetAlert2) — already handled above via .mm-dialog */

/* Unified chat widget (assets/js/lib/unified-chat.js + unified-chat.css).
 *
 * The widget scopes its OWN copies of the brand tokens onto `.mmc-root`
 * so it renders consistently on pages that don't load the canonical
 * :root block from detail_posted.php. The same scoping makes the
 * html.theme-dark overrides further up this file IRRELEVANT inside the
 * widget — `.mmc-root` is closer to the variable consumer in the cascade.
 *
 * Solution: re-declare the same tokens on `.mmc-root` when dark mode
 * is on. Specificity is (0,1,1) [html.theme-dark] + (0,1,0) [.mmc-root]
 * = (0,2,1), beating the (0,1,0) of `.mmc-root` alone. Once these
 * tokens point at dark values, every existing widget rule using
 * `var(--white)` / `var(--ink-900)` / `var(--ink-tint)` / etc. picks
 * up the dark version automatically — including the .me-bubble
 * (`background: var(--ink-tint); color: var(--ink-900)`), the
 * messages background (`background: var(--white)`), avatars, chips,
 * project-context strips, and the composer. No per-element rules.
 *
 * Purple is bumped lighter for visibility on dark; other-bubble
 * --line shadow keeps the bubble outline subtle.
 */
html.theme-dark .mmc-root {
    --white:          var(--mm-surface-1);
    --bg:             var(--mm-bg);
    --soft:           var(--mm-surface-2);

    --line:           var(--mm-divider);
    --line-2:         var(--mm-border);

    /* The light-mode ink scale ran #2D405A → #99A2AD (dark navy down to
     * mid-grey). In dark mode every step lifts to the white end of the
     * scale — titles pure white, body almost white, and even the most
     * muted tier stays clearly light. */
    --ink-900:        var(--mm-text);              /* titles  — #ffffff   */
    --ink-700:        rgba(255, 255, 255, 0.95);   /* body    — almost white */
    --ink-500:        rgba(255, 255, 255, 0.82);   /* secondary */
    --ink-400:        rgba(255, 255, 255, 0.68);   /* most muted, still light */
    --ink-tint:       var(--mm-surface-2);

    --primary:        var(--mm-brand);
    --primary-tint:   var(--mm-brand-soft);
    --primary-tint-2: rgba(255, 107, 71, 0.10);

    --purple:         #b89cf0;
    --purple-2:       #d4c2ff;
    --purple-tint:    rgba(180, 156, 240, 0.18);

    --warn:           var(--mm-warning);
    --warn-bg:        var(--mm-warning-soft);
    --warn-line:      rgba(251, 191, 36, 0.35);
    --success:        var(--mm-success);
    --success-bg:     var(--mm-success-soft);
}
/* Hairline that the bubble box-shadow draws against the messages
 * area: the var() resolves to dark inside the widget thanks to the
 * block above, but the rgba in the second shadow stop is a literal —
 * tone it down so the shadow doesn't punch a light halo on dark. */
html.theme-dark .mmc-root .mmc-bubble {
    box-shadow: 0 1px 0 var(--mm-divider), 0 1px 2px rgba(0, 0, 0, 0.4);
}
/* The .me-bubble already gets --ink-tint (dark surface) from the
 * token block above; pin the text colour explicitly to keep parity
 * with .mmc-bubble color rule which uses --ink-900 (now white). */
html.theme-dark .mmc-root .mmc-msg-row.me .mmc-bubble {
    color: var(--mm-text);
    border-color: var(--mm-border);
}
/* Date / unread separators in the message thread + system rows */
html.theme-dark .mmc-root .mmc-day-divider,
html.theme-dark .mmc-root .mmc-sys-row {
    color: var(--mm-text-muted);
}

/* Purple SURFACES that carry white content — the launcher, the
 * composer send button, the strip / approval CTAs, the flow CTA, and
 * the checked-state checkbox. The --purple token is lightened in dark
 * mode (#b89cf0) so purple-as-TEXT — pills, read-ticks, links on the
 * dark thread — has contrast; but that pale lavender is far too light
 * to sit a white icon or label on. Pin these surfaces to a mid purple
 * — brighter than the light-mode brand #54387F, which read dull on the
 * dark UI, but still deep enough to keep white content legible. */
html.theme-dark .mmc-launcher,
html.theme-dark .mmc-strip-cta:hover,
html.theme-dark .mmc-approval-cta:hover,
html.theme-dark .mmc-composer .mmc-send,
html.theme-dark .mmc-flow-cta,
html.theme-dark .mmc-flow-person.is-checked .mmc-flow-person-check {
    background: #6e4fb0;
}
html.theme-dark .mmc-launcher:hover,
html.theme-dark .mmc-flow-cta:hover {
    background: #583f8c;
}

/* Restore purple resting state on the View-job / Project-chat strip
 * CTA in dark mode. .mmc-strip-cta is an <a>, so the blanket
 * `html.theme-dark a:not(.btn) { color: var(--mm-brand) }` rule
 * above repainted it orange — defeating the purple var(--purple)
 * declared on the base .mmc-strip-cta rule. Specificity tying
 * `a.mmc-strip-cta` to .theme-dark (0,2,2) matches the anchor rule's
 * specificity exactly, and source order (this block is later in the
 * stylesheet) wins. Hover still flips to the white-on-purple fill
 * via the existing rule above. */
html.theme-dark a.mmc-strip-cta,
html.theme-dark a.mmc-strip-cta:visited {
    color: var(--purple);
    border-color: var(--purple);
}
html.theme-dark a.mmc-strip-cta:hover,
html.theme-dark a.mmc-strip-cta:focus {
    color: #fff;
}
/* "New group" flow inputs are designed borderless — the name field is
 * underline-only, the people-search input sits inside its own styled
 * pill. The broad dark input rule (input[type="text"]) gave them a full
 * box + surface fill, so the search rendered as a box inside the pill
 * and the name field grew a stray border. Restore their intended
 * chrome (id selectors out-specify the broad rule). */
html.theme-dark input#mmc-flow-name-input {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 2px solid var(--mm-border-strong) !important;
}
html.theme-dark input#mmc-flow-name-input:focus {
    border-bottom-color: var(--purple) !important;
}
html.theme-dark input#mmc-flow-search-input {
    background: transparent !important;
    border: 0 !important;
}

/* ---------- Embedded project chat (/project/detail) ----------------
 * The inline chat panel on the project-detail page — a SEPARATE
 * component from the floating unified-chat widget (.mmc-*). It has
 * its own legacy stylesheets (assets/front/chat.css + detail1.css)
 * with light surfaces hard-coded throughout — white panels, a
 * translucent light-grey message bubble, an #F5F6F6 detail strip,
 * white date-divider pills, a white composer. None of it is
 * token-driven, so it needs its own explicit dark pass. Selectors +
 * !important mirror the legacy rules they override. */

/* Message thread container — match the chat panel card (--mm-surface-1),
 * NOT the page background. The thread + composer sit INSIDE the chat
 * card; painting them --mm-bg (near-black) made them read as a darker
 * inset region against the lighter card. Light mode has the card,
 * thread and composer all the same white — mirror that. */
html.theme-dark .chat-box-whole,
html.theme-dark #chat_wraper {
    background: var(--mm-surface-1);
}

/* Top collapse panel ("Explainer Video for …") + its detail strip */
html.theme-dark .Chat-main .collaps-main,
html.theme-dark .Chat-main .collaps-main .card,
html.theme-dark .Chat-main .card {
    background: var(--mm-surface-1) !important;
    color: var(--mm-text);
    box-shadow: var(--mm-shadow-1);
}
/* The inner package/buttons .card carries a 0 1px 2px rgba(0,0,0,.4)
 * drop shadow — the card sits directly above the collapse chevron, so
 * that shadow paints a dark hairline above the arrow. Drop the shadow
 * on the collapse panel so no line shows. */
html.theme-dark .Chat-main .collaps-main,
html.theme-dark .Chat-main .collaps-main .card {
    box-shadow: none !important;
}
/* `.collapsed-details` is the WRAPPER around the package/quantity/
 * deadline strip — it must stay at the panel surface (--mm-surface-1)
 * so the `.status` strip inside it (--mm-surface-2, set below) reads
 * as a distinct inset rounded card. Painting the wrapper the same
 * --mm-surface-2 as the strip flattened the two together — the strip
 * lost its card framing and looked full-bleed. Mirrors light mode:
 * white panel -> white wrapper -> light-grey strip card. */
html.theme-dark .Chat-main .collaps-main .collapsed-details {
    background: var(--mm-surface-1) !important;
}
/* The collapse chevron (.top-collapsed-mobile) is a bare Bootstrap .btn
 * — keep its top edge transparent so there is no divider line above
 * the handle. */
html.theme-dark .Chat-main .top-collapsed-mobile {
    border-top-color: transparent !important;
}
html.theme-dark .Chat-main .collaps-main .collapsed-details p,
html.theme-dark .Chat-main .collaps-main .collapsed-details ul li span {
    color: var(--mm-text-muted);
}
html.theme-dark .Chat-main .collaps-main .collapsed-details ul li.active span {
    color: var(--mm-text);
}
/* Collapse-panel TITLE — `.top-collapsed` is an <a> the legacy chat.css
 * pins to navy #2D405A, which reads as a faint blue on the dark panel.
 * Lift it (and its collapse chevron) to white. The mobile variant
 * `.top-collapsed-mobile` is a bare `.btn` whose chevron inherits
 * Bootstrap's near-black #212529 — invisible on dark — so cover it
 * here too. */
html.theme-dark .Chat-main .top-collapsed,
html.theme-dark .Chat-main .top-collapsed i,
html.theme-dark .Chat-main .top-collapsed .fa,
html.theme-dark .Chat-main .top-collapsed-mobile,
html.theme-dark .Chat-main .top-collapsed-mobile i,
html.theme-dark .Chat-main .top-collapsed-mobile .fa {
    color: var(--mm-text) !important;
}
/* The package/quantity/deadline strip is `.status`, hard-pinned by
 * chat.css to `background:#F5F6F6 !important`. Darken it and lift its
 * value text (chat.css leaves "2 minutes" / the deadline at #56606D,
 * invisible on dark); the labels are already white, links stay brand. */
html.theme-dark .status {
    background: var(--mm-surface-2) !important;
}
html.theme-dark .status p,
html.theme-dark .status span {
    color: var(--mm-text) !important;
}
html.theme-dark .status a {
    color: var(--mm-brand) !important;
}

/* Chat header */
html.theme-dark .chat .chat-header {
    border-bottom-color: var(--mm-border);
}
html.theme-dark .chat .chat-header .chat-about h1 {
    color: var(--mm-text);
}

/* Message bubbles — received. The legacy fill is a translucent
 * rgba(243,243,243,.7); a solid dark surface reads far cleaner on
 * dark than letting the page show through a light translucent layer. */
html.theme-dark .sms-main {
    background: var(--mm-surface-2) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
/* Sent ("send") bubble — was #EFF1F9 light lavender */
html.theme-dark .sms-main.send {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
}
/* Links inside a bubble keep the brand accent */
html.theme-dark .sms-main a {
    color: var(--mm-brand) !important;
    background: transparent !important;
}

/* Deadline-update / system messages. Project.php (deadline-change flow)
 * bakes a light-mode `<div style="background:#FFF7F5;border:1px solid
 * #FDDDD7;color:#56606D">` straight into the stored message HTML, with
 * `<b style="color:#2D405A">` (name) + `<b style="color:#EF5537">`
 * (date) inside. Those inline styles are persisted in the DB, so they
 * can't be reached by a class hook — only !important on a structural
 * selector overrides them. Re-skin the inline-styled box as a subtle
 * warm system-message tint that works on dark; lift the navy name to
 * white and the date to the brighter dark-mode brand orange. */
html.theme-dark .sms-main > div[style] {
    background: var(--mm-brand-soft) !important;
    border-color: rgba(255, 107, 71, 0.28) !important;
    color: var(--mm-text) !important;
}
html.theme-dark .sms-main > div[style] b {
    color: var(--mm-brand) !important;
}
html.theme-dark .sms-main > div[style] b:first-of-type {
    color: var(--mm-text) !important;
}
/* Sender name + per-message timestamp */
html.theme-dark .sms-user-name {
    color: var(--mm-text) !important;
}
html.theme-dark .sms-date {
    color: var(--mm-text-muted) !important;
}
/* "Add user" chip in the chat participant row — the #686A6D grey
 * outline + plus glyph read dim on the dark panel; lift them. */
html.theme-dark .tags-input .tag.add-user {
    border-color: var(--mm-text-muted) !important;
}
html.theme-dark .tags-input .tag.add-user .plus-icon,
html.theme-dark .tags-input .tag.add-user .text {
    color: var(--mm-text-muted) !important;
}

/* Date dividers ("Tuesday, 12 May") — the pill masks the hairline
 * running behind it, so its fill must match the chat thread it sits on
 * (--mm-surface-1). --mm-bg was darker than the thread, leaving a
 * visible dark chip; surface-1 makes only the text show. */
html.theme-dark .sms-date-text {
    background-color: var(--mm-surface-1);
    color: var(--mm-text-muted);
}
html.theme-dark .date-text-container::after {
    border-top-color: var(--mm-border);
}

/* Presence dot — the white ring should match the surface it sits on */
html.theme-dark .online-status {
    border-color: var(--mm-surface-1);
}

/* Member chips in the "Add user" row. The chip carries a normal inline
 * `color:#78808A`; on dark, lift the name to white. An author
 * !important rule beats a normal inline style, so this wins without
 * touching the markup. (Per-role purple/orange was already dropped in
 * detail.php — all chips are one neutral colour now.) */
html.theme-dark .chat .tag,
html.theme-dark .chat .tag .text {
    color: var(--mm-text) !important;
}

/* Composer. `.chat-message` is the wrapper around the input row and
 * renders on a hard white background. Darken it to the chat panel
 * surface (--mm-surface-1) — same as the thread above it — so it
 * blends seamlessly; --mm-bg here left a near-black band below the
 * input box, darker than the surrounding card. */
html.theme-dark .chat-message,
html.theme-dark .chat .chat-message {
    background-color: var(--mm-surface-1) !important;
}
html.theme-dark .input-group-custom {
    border-color: var(--mm-border);
    background-color: var(--mm-surface-input);
}
html.theme-dark .chat .chat-message .input-group .input-group-text {
    background-color: var(--mm-surface-input);
    border-right-color: var(--mm-border);
}
/* The page-scoped #E8EFF6 divider between the paperclip icon and the
 * textarea renders as a bright white slash on the dark input. Tone it
 * down to match the paperclip icon's apparent brightness on dark
 * (mid-muted white, ~0.35 alpha) — a visible separator but not a
 * stark white slash. */
html.theme-dark .input-group-custom .span-customClass {
    border-right-color: rgba(255, 255, 255, 0.35) !important;
}
html.theme-dark .chat .chat-message .form-control,
html.theme-dark .chat-area {
    background-color: var(--mm-surface-input) !important;
    color: var(--mm-text);
    border-top-color: var(--mm-border) !important;
}

/* Per-message ⋮ actions dropdown */
html.theme-dark .dropdown-small-modal,
html.theme-dark .small-modal-left ul,
html.theme-dark .small-modal-left ul::before,
html.theme-dark .small-modal-left ul::after {
    background: var(--mm-surface-3) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text);
}
/* The row items carry their own `color: #111` — near-black on the dark
 * menu. Target the <li> directly so Reply / Edit / Delete read light. */
html.theme-dark .small-modal ul li,
html.theme-dark .small-modal-left ul li,
html.theme-dark .dropdown-small-modal ul li {
    color: var(--mm-text);
}
/* The row icons are inline <svg> with a hard-coded stroke="black"
 * presentation attribute — CSS `stroke` outranks it. */
html.theme-dark .small-modal ul li svg path,
html.theme-dark .small-modal-left ul li svg path,
html.theme-dark .dropdown-small-modal ul li svg path {
    stroke: var(--mm-text);
}
html.theme-dark .dropdown-small-modal ul li:hover,
html.theme-dark .small-modal-left ul li:hover {
    background: var(--mm-surface-hover) !important;
}

/* Outline action buttons in the panel header (Final Delivery,
 * Request Approval, Navigate to Jobs) — white-fill in light mode. */
html.theme-dark .payment-button {
    background: var(--mm-surface-2) !important;
    color: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
}
html.theme-dark .payment-button.fill,
html.theme-dark .btn.bg-bright-red {
    background: var(--mm-brand) !important;
    color: #fff !important;
}
/* "Paid" milestone status (.btn-paid) — a green pill in light mode
 * (#02A813 on #EFF9F0); the blanket .payment-button rule above repainted
 * it brand-orange on dark. Restore it to green. */
html.theme-dark .btn-paid,
html.theme-dark .payment-button.btn-paid {
    background: var(--mm-success-soft) !important;
    border-color: var(--mm-success) !important;
    color: var(--mm-success) !important;
}
/* In the mobile milestone list "Paid" is a plain text label (no border
 * by design) — drop the fill there so it's just green text. */
html.theme-dark .milestone_detail-mobile .payment-button.btn-paid {
    background: transparent !important;
}
/* "Navigate to Jobs" is a borderless text link, not a button — in light
 * mode its white fill blends into the white panel. In dark mode the
 * `.payment-button` surface fill above turns it into a visible grey box.
 * Strip the fill so it reads as a plain link like it does on light. */
html.theme-dark .payment-button.navigation,
html.theme-dark .payment-button.navigation-mobile {
    background: transparent !important;
}


/* ----------------------------------------------------------------------------
   6. Toggle UI
   ---------------------------------------------------------------------------- */

/* Navbar pill button */
.mm-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 8px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background: transparent;
    color: #555;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
    line-height: 1;
}
.mm-theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #222;
}
.mm-theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 85, 55, 0.25);
}
.mm-theme-toggle .mm-theme-toggle__icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}
.mm-theme-toggle .mm-theme-toggle__sun  { display: none; }
.mm-theme-toggle .mm-theme-toggle__moon { display: inline-block; }

/* When the toggle lives in the sidebar nav list, theme-toggle.js still
 * stamps it .mm-theme-toggle (the 38px circular-pill geometry above).
 * Undo that so it renders as an ordinary full-width .nav-link row —
 * the .nav-link rules supply the padding, colour and layout. */
.sidebar .nav .nav-item .nav-link.mm-theme-toggle {
    width: auto;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    display: flex;
    justify-content: flex-start;
}
/* The sun/moon label spans also carry .menu-title, whose nav display
 * rule out-specifies the plain .mm-theme-toggle__sun/__moon swap — so
 * both labels showed at once. Force the swap with !important. */
.nav-link.mm-theme-toggle .mm-theme-toggle__sun  { display: none !important; }
html.theme-dark .nav-link.mm-theme-toggle .mm-theme-toggle__sun  { display: inline-block !important; }
html.theme-dark .nav-link.mm-theme-toggle .mm-theme-toggle__moon { display: none !important; }

html.theme-dark .mm-theme-toggle {
    border-color: var(--mm-border);
    color: var(--mm-text);
}
html.theme-dark .mm-theme-toggle:hover {
    background-color: var(--mm-surface-hover);
    color: var(--mm-text);
}
html.theme-dark .mm-theme-toggle .mm-theme-toggle__sun  { display: inline-block; }
html.theme-dark .mm-theme-toggle .mm-theme-toggle__moon { display: none; }

/* Floating variant (used on standalone HTML auth/landing screens) */
.mm-theme-toggle--floating {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
html.theme-dark .mm-theme-toggle--floating {
    background: rgba(35, 35, 37, 0.92);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}


/* ----------------------------------------------------------------------------
   6b. Checklist confirmation modals

   Two near-identical custom modals live in page-scoped <style> blocks:
   `.mm-confirm-*` (task/proposal.php — "Job Invite") and `.mm-proposal-*`
   (bid/add.php — "One Last Step"). Both were authored white-only — panel,
   checklist cards, footer, checkboxes all hard-code light colours. Re-skin
   the whole family for dark here so it tracks the rest of the theme.
   ---------------------------------------------------------------------------- */
/* Panel */
html.theme-dark .mm-confirm-modal,
html.theme-dark .mm-proposal-modal {
    background: var(--mm-surface-2) !important;
    border: 1px solid var(--mm-border) !important;
}
/* Title */
html.theme-dark .mm-confirm-title,
html.theme-dark .mm-proposal-title {
    color: var(--mm-text) !important;
}
/* Close (×) button */
html.theme-dark .mm-confirm-close,
html.theme-dark .mm-proposal-close {
    color: var(--mm-text-muted) !important;
}
html.theme-dark .mm-confirm-close:hover,
html.theme-dark .mm-proposal-close:hover {
    background: var(--mm-surface-3) !important;
    color: var(--mm-text) !important;
}
/* Purple "By accepting…" sub-line + its inline-styled shield SVG */
html.theme-dark .mm-confirm-sub,
html.theme-dark .mm-proposal-sub {
    color: #b89cf0 !important;
}
html.theme-dark .mm-confirm-sub svg path,
html.theme-dark .mm-proposal-sub svg path {
    stroke: #b89cf0 !important;
}
/* Checklist cards */
html.theme-dark .mm-confirm-item,
html.theme-dark .mm-proposal-item {
    background: var(--mm-surface-3) !important;
    border-color: var(--mm-border) !important;
}
html.theme-dark .mm-confirm-item:hover,
html.theme-dark .mm-proposal-item:hover {
    background: var(--mm-surface-input) !important;
}
html.theme-dark .mm-confirm-item.is-checked,
html.theme-dark .mm-proposal-item.is-checked {
    background: var(--mm-brand-soft) !important;
    border-color: var(--mm-brand) !important;
}
html.theme-dark .mm-confirm-item.is-checked .mm-item-title,
html.theme-dark .mm-proposal-item.is-checked .mm-proposal-item-title {
    color: var(--mm-brand) !important;
}
/* Card text */
html.theme-dark .mm-item-title,
html.theme-dark .mm-proposal-item-title {
    color: var(--mm-text) !important;
}
html.theme-dark .mm-item-sub,
html.theme-dark .mm-proposal-item-sub {
    color: var(--mm-text-muted) !important;
}
/* Custom checkbox */
html.theme-dark .mm-confirm-item input.mm-invite-check,
html.theme-dark .mm-proposal-item input.mm-proposal-check {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border-strong) !important;
}
html.theme-dark .mm-confirm-item input.mm-invite-check:checked,
html.theme-dark .mm-proposal-item input.mm-proposal-check:checked {
    background: var(--mm-brand) !important;
    border-color: var(--mm-brand) !important;
}
/* Footer */
html.theme-dark .mm-confirm-actions,
html.theme-dark .mm-proposal-actions {
    background: var(--mm-surface-1) !important;
    border-top: 1px solid var(--mm-border) !important;
}
/* Primary / danger button */
html.theme-dark .mm-btn-danger,
html.theme-dark .mm-proposal-btn-primary {
    background: var(--mm-brand) !important;
    color: #fff !important;
}
html.theme-dark .mm-btn-ok:disabled,
html.theme-dark .mm-proposal-btn-primary:disabled {
    background: rgba(255, 107, 71, 0.32) !important;
    color: rgba(255, 255, 255, 0.55) !important;
}
/* Ghost / outline button */
html.theme-dark .mm-btn-cancel,
html.theme-dark .mm-proposal-btn-outline {
    background: transparent !important;
    border-color: var(--mm-brand) !important;
    color: var(--mm-brand) !important;
}
html.theme-dark .mm-btn-cancel:hover,
html.theme-dark .mm-proposal-btn-outline:hover {
    background: var(--mm-brand-soft) !important;
}

/* ----------------------------------------------------------------------------
   6c. Portfolio view modal (creator profile)

   The #viewPortfolioCenter modal shows a portfolio image/video plus a
   title label and a category pill. The title is `label.col-form-label`
   (hard-coded #000 — invisible on the dark modal) and the pill is
   `.title_text` (a pale #f2f2f2 chip). Re-skin both, scoped to the
   modal id so no other col-form-label / title_text is affected.
   ---------------------------------------------------------------------------- */
html.theme-dark #viewPortfolioCenter .col-form-label,
html.theme-dark #viewPortfolioCenter .portfolio-view-labels {
    color: var(--mm-text) !important;
}
html.theme-dark #viewPortfolioCenter .title_text {
    /* The modal surface is itself --mm-surface-3, so the pill needs a
     * darker fill + border to read as a distinct chip. */
    background: var(--mm-surface-1) !important;
    border: 1px solid var(--mm-border) !important;
    color: var(--mm-text) !important;
}

/* Manager rating screen (project/review.php). Its page-scoped <style>
 * hardcodes the .project-details .wrapper to #fff and the .review-box
 * star tray to #fafafa, leaving a bright white card on dark. Scope the
 * dark overrides to `:has(.review-box)` so they only fire on the review
 * page (other .project-details views have their own treatment). */
html.theme-dark .project-details .wrapper:has(.review-box) {
    background-color: var(--mm-surface-1) !important;
}
html.theme-dark .project-details .wrapper:has(.review-box) .heading {
    border-bottom-color: var(--mm-border) !important;
}
html.theme-dark .project-details .wrapper:has(.review-box) .heading .title,
html.theme-dark .project-details .wrapper:has(.review-box) .sub-title,
html.theme-dark .project-details .wrapper:has(.review-box) .all-stars p {
    color: var(--mm-text) !important;
}
html.theme-dark .review-box {
    background: var(--mm-surface-3) !important;
}
html.theme-dark #review_descr {
    background: var(--mm-surface-input) !important;
    border-color: var(--mm-border) !important;
    color: var(--mm-text) !important;
}
/* Portfolio / reviews pagination — the "Previous" arrow uses a SOLID
 * filled chevron asset (left-arrow.svg / left-arrow.png). Greyscaled
 * for its inactive state, that solid shape reads as a light blob on
 * the black backdrop, while "Next" is a clean stroked chevron. Swap in
 * a mirrored copy of the stroked right-arrow so both arrows match;
 * grayscale(1)/(0) from style.css still drives the inactive→grey /
 * active→orange states. */
html.theme-dark .arrow-left,
html.theme-dark .arrow-left-review {
    content: url("../images/right-arrow.svg");
    transform: scaleX(-1);
}

/* ----------------------------------------------------------------------------
   7. Print
   ---------------------------------------------------------------------------- */
@media print {
    html.theme-dark,
    html.theme-dark body,
    html.theme-dark .card,
    html.theme-dark .modal-content,
    html.theme-dark .table {
        background: #fff !important;
        color: #000 !important;
    }
    html.theme-dark a { color: #000 !important; }
    .mm-theme-toggle { display: none !important; }
}
