/*
 * Eastern Right of Way Services
 * Shared light/dark theme overrides
 *
 * Load this file AFTER each page's existing inline <style> block.
 */

html {
    color-scheme: light;
}

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

    --bg: #0f1720;
    --panel: #18212b;
    --panel-border: #344150;
    --border: #344150;
    --text: #e7edf4;
    --muted: #aab6c4;

    --accent: #72afe8;
    --accent-dark: #1c3144;
    --accent-soft: #203a53;

    --button: #24313e;
    --button-border: #465566;
    --row-hover: #202d3a;
    --hover: #202d3a;

    --success: #163525;
    --success-border: #2e7952;
    --warning: #3c3115;
    --warning-border: #8f742e;
    --danger: #f06a6a;
    --danger-dark: #d64e4e;
}

body,
.panel,
.card,
.header,
.btn,
input,
select,
textarea,
table,
th,
td {
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        color 140ms ease;
}

html[data-theme="dark"] body {
    background: var(--bg) !important;
    color: var(--text) !important;
}

/* Main surfaces */
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .summary-item,
html[data-theme="dark"] .section,
html[data-theme="dark"] .user-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .detail-value,
html[data-theme="dark"] .portal-status-entry,
html[data-theme="dark"] .map-status,
html[data-theme="dark"] .important-note-popup,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .dialog,
html[data-theme="dark"] .tab-panel {
    background: var(--panel) !important;
    color: var(--text) !important;
    border-color: var(--panel-border) !important;
}

/* Keep branded headers dark in both modes */
html[data-theme="dark"] .header {
    background: #172b3d !important;
    color: #ffffff !important;
    border-color: #0b1a27 !important;
}

html[data-theme="dark"] .header .title,
html[data-theme="dark"] .header .subtitle,
html[data-theme="dark"] .header .brand,
html[data-theme="dark"] .header-row {
    color: #ffffff;
}

/* Secondary surfaces */
html[data-theme="dark"] .panel-head,
html[data-theme="dark"] th,
html[data-theme="dark"] thead td,
html[data-theme="dark"] .detail-label,
html[data-theme="dark"] .tab-bar,
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .filter-bar {
    background: #1d2833 !important;
    color: var(--text) !important;
    border-color: var(--panel-border) !important;
}

html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-color: #2f3c49 !important;
}

html[data-theme="dark"] tbody tr:hover {
    background: var(--row-hover) !important;
}

/* Form controls */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #111a23 !important;
    color: var(--text) !important;
    border-color: var(--button-border) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8794a3;
    opacity: 1;
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] textarea[readonly],
html[data-theme="dark"] .readonly {
    background: #1a242e !important;
    color: #aeb9c5 !important;
    opacity: 1;
}

html[data-theme="dark"] option {
    background: #111a23;
    color: var(--text);
}

/* Buttons and pills */
html[data-theme="dark"] .btn:not(.primary):not(.danger):not(.active):not(.document-open):not(.success),
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .link-btn.secondary,
html[data-theme="dark"] .filter-pill,
html[data-theme="dark"] .theme-toggle {
    background: var(--button) !important;
    color: var(--text) !important;
    border-color: var(--button-border) !important;
}

html[data-theme="dark"] .btn:not(.primary):not(.danger):not(.success):hover,
html[data-theme="dark"] .secondary:hover,
html[data-theme="dark"] .filter-pill:hover,
html[data-theme="dark"] .theme-toggle:hover {
    background: #2d3c4a !important;
    border-color: #5b6d7f !important;
}

html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn.active,
html[data-theme="dark"] .document-open {
    background: #397bb5 !important;
    color: #ffffff !important;
    border-color: #397bb5 !important;
}

html[data-theme="dark"] .btn.danger {
    color: #ffffff !important;
}

/* Links */
html[data-theme="dark"] a:not(.btn):not(.link-btn),
html[data-theme="dark"] .owner-link {
    color: #83bdf2;
}

/* Status and information blocks */
html[data-theme="dark"] .flash.success,
html[data-theme="dark"] .success,
html[data-theme="dark"] .document-card {
    background: var(--success) !important;
    border-color: var(--success-border) !important;
    color: #d8f3e4 !important;
}

html[data-theme="dark"] .flash.warning,
html[data-theme="dark"] .warning {
    background: var(--warning) !important;
    border-color: var(--warning-border) !important;
    color: #f3e3ad !important;
}

html[data-theme="dark"] .flash:not(.success):not(.warning),
html[data-theme="dark"] .notice {
    background: #172d43 !important;
    border-color: #345b7f !important;
    color: #d7e9f8 !important;
}

html[data-theme="dark"] .error,
html[data-theme="dark"] .badge.inactive {
    background: #3a1d22 !important;
    border-color: #81414b !important;
    color: #ffb9c1 !important;
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] .badge.admin {
    background: var(--accent-soft) !important;
    color: #b9ddff !important;
}

/* Owner-priority rows currently use inline background colors */
html[data-theme="dark"] tr[style*="#e8f5e9"],
html[data-theme="dark"] tr[style*="#e8f7ee"] {
    background: #173223 !important;
}

html[data-theme="dark"] tr[style*="#fff3cd"],
html[data-theme="dark"] tr[style*="#fff8e6"] {
    background: #3b3118 !important;
}

html[data-theme="dark"] tr[style*="#f8d7da"],
html[data-theme="dark"] tr[style*="#fff1f2"] {
    background: #3b1f24 !important;
}

/* Common hard-coded white/light components in current pages */
html[data-theme="dark"] .filter-pill,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .user-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .detail-value,
html[data-theme="dark"] .portal-status-entry,
html[data-theme="dark"] .map-status,
html[data-theme="dark"] .important-note-popup {
    background: var(--panel) !important;
}

html[data-theme="dark"] code {
    background: #111a23;
    color: #d7e9f8;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 2px 5px;
}

html[data-theme="dark"] hr {
    border-color: var(--panel-border);
}

/* Theme toggle */
.theme-toggle {
    gap: 7px;
    white-space: nowrap;
}

.theme-toggle-icon {
    width: 1.1em;
    text-align: center;
    font-size: 17px;
    line-height: 1;
}

.theme-toggle-floating {
    position: fixed;
    z-index: 100000;
    top: 16px;
    right: 16px;
    width: auto !important;
    min-width: 118px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

html[data-theme="dark"] .theme-toggle-floating {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

@media (max-width: 560px) {
    .theme-toggle-label {
        display: none;
    }

    .theme-toggle {
        min-width: 42px !important;
        width: 42px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .theme-toggle-floating {
        top: 10px;
        right: 10px;
    }
}

@media print {
    .theme-toggle {
        display: none !important;
    }
}

/* =====================================================================
   Targeted dark-mode corrections
   - Dashboard project-status filters
   - External-user permission and assigned-project cards
   - Internal owner Status Notes
   - Preserve owner priority row highlights
   ===================================================================== */

/* Dashboard project-status filter pills */
html[data-theme="dark"] .status-filters .filter-pill {
    background: #22303d !important;
    color: #e7edf4 !important;
    border-color: #526477 !important;
}

html[data-theme="dark"] .status-filters .filter-pill span {
    color: inherit !important;
}

html[data-theme="dark"] .status-filters .filter-pill:hover {
    background: #2b3b4a !important;
    border-color: #6a7d90 !important;
}

html[data-theme="dark"] .status-filters .filter-pill:has(input:checked) {
    background: #315f86 !important;
    color: #ffffff !important;
    border-color: #7eb7e8 !important;
}

html[data-theme="dark"] .status-filters input[type="radio"] {
    accent-color: #7eb7e8;
}


/* External-user portal permission cards */
html[data-theme="dark"] .permission-card,
html[data-theme="dark"] .permission-item,
html[data-theme="dark"] .permission-option,
html[data-theme="dark"] .portal-permission-card,
html[data-theme="dark"] .portal-permission-item,
html[data-theme="dark"] .portal-permission-option,
html[data-theme="dark"] .permissions-grid > label,
html[data-theme="dark"] .permission-grid > label,
html[data-theme="dark"] .portal-permissions-grid > label,
html[data-theme="dark"] .portal-permission-grid > label,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="permission"]) {
    background: #1d2833 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] .permission-card:hover,
html[data-theme="dark"] .permission-item:hover,
html[data-theme="dark"] .permission-option:hover,
html[data-theme="dark"] .portal-permission-card:hover,
html[data-theme="dark"] .portal-permission-item:hover,
html[data-theme="dark"] .portal-permission-option:hover,
html[data-theme="dark"] .permissions-grid > label:hover,
html[data-theme="dark"] .permission-grid > label:hover,
html[data-theme="dark"] .portal-permissions-grid > label:hover,
html[data-theme="dark"] .portal-permission-grid > label:hover,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="permission"]):hover {
    background: #243442 !important;
    border-color: #607488 !important;
}


/* External-user Assigned Projects cards.
   The name-based selectors catch project_ids[], assigned_projects[],
   portal_project_ids[], and similar implementations. */
html[data-theme="dark"] .assigned-project-card,
html[data-theme="dark"] .assigned-project-item,
html[data-theme="dark"] .assigned-project-option,
html[data-theme="dark"] .project-assignment-card,
html[data-theme="dark"] .project-assignment-item,
html[data-theme="dark"] .project-assignment-option,
html[data-theme="dark"] .assigned-projects-grid > label,
html[data-theme="dark"] .assigned-project-grid > label,
html[data-theme="dark"] .project-assignment-grid > label,
html[data-theme="dark"] .project-options > label,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="project"]) {
    background: #1d2833 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] .assigned-project-card:hover,
html[data-theme="dark"] .assigned-project-item:hover,
html[data-theme="dark"] .assigned-project-option:hover,
html[data-theme="dark"] .project-assignment-card:hover,
html[data-theme="dark"] .project-assignment-item:hover,
html[data-theme="dark"] .project-assignment-option:hover,
html[data-theme="dark"] .assigned-projects-grid > label:hover,
html[data-theme="dark"] .assigned-project-grid > label:hover,
html[data-theme="dark"] .project-assignment-grid > label:hover,
html[data-theme="dark"] .project-options > label:hover,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="project"]):hover {
    background: #243442 !important;
    border-color: #607488 !important;
}

/* Readable secondary text within permission/project cards */
html[data-theme="dark"] .permission-card small,
html[data-theme="dark"] .permission-item small,
html[data-theme="dark"] .permission-option small,
html[data-theme="dark"] .portal-permission-card small,
html[data-theme="dark"] .portal-permission-item small,
html[data-theme="dark"] .portal-permission-option small,
html[data-theme="dark"] .assigned-project-card small,
html[data-theme="dark"] .assigned-project-item small,
html[data-theme="dark"] .assigned-project-option small,
html[data-theme="dark"] .project-assignment-card small,
html[data-theme="dark"] .project-assignment-item small,
html[data-theme="dark"] .project-assignment-option small,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="permission"]) small,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="project"]) small,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="permission"]) .subtle,
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="project"]) .subtle {
    color: #aab6c4 !important;
}

html[data-theme="dark"] .permission-card input[type="checkbox"],
html[data-theme="dark"] .permission-item input[type="checkbox"],
html[data-theme="dark"] .permission-option input[type="checkbox"],
html[data-theme="dark"] .assigned-project-card input[type="checkbox"],
html[data-theme="dark"] .assigned-project-item input[type="checkbox"],
html[data-theme="dark"] .assigned-project-option input[type="checkbox"],
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="permission"]) input[type="checkbox"],
html[data-theme="dark"] label:has(> input[type="checkbox"][name*="project"]) input[type="checkbox"] {
    accent-color: #6eafe7;
}


/* Internal owner Status Notes section */
html[data-theme="dark"] #statusNotesSection,
html[data-theme="dark"] #status-notes-section,
html[data-theme="dark"] .status-notes-section,
html[data-theme="dark"] .status-notes-wrap,
html[data-theme="dark"] .owner-status-notes,
html[data-theme="dark"] .status-update-form,
html[data-theme="dark"] .status-note-form,
html[data-theme="dark"] .status-entry-form,
html[data-theme="dark"] .status-update-card,
html[data-theme="dark"] .status-note-card,
html[data-theme="dark"] .status-entry-card,
html[data-theme="dark"] .status-update-entry,
html[data-theme="dark"] .status-note-entry,
html[data-theme="dark"] .status-log-entry,
html[data-theme="dark"] .status-history-entry,
html[data-theme="dark"] form:has([name="action"][value*="status"]),
html[data-theme="dark"] form:has(textarea[name="update_text"]),
html[data-theme="dark"] form:has(textarea[name*="status_update"]),
html[data-theme="dark"] form:has(textarea[name*="status_note"]),
html[data-theme="dark"] div:has(> form [name="action"][value*="status"]),
html[data-theme="dark"] article:has(form [name="action"][value*="status"]),
html[data-theme="dark"] section:has(form [name="action"][value*="status"]) {
    background: #18212b !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

/* Some implementations place the visible card one level above the action form */
html[data-theme="dark"] div:has(> div > form [name="action"][value*="status"]),
html[data-theme="dark"] div:has(> form:has(textarea[name="update_text"])),
html[data-theme="dark"] div:has(> form:has(textarea[name*="status_update"])),
html[data-theme="dark"] div:has(> form:has(textarea[name*="status_note"])) {
    background: #18212b !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] #statusNotesSection label,
html[data-theme="dark"] #status-notes-section label,
html[data-theme="dark"] .status-notes-section label,
html[data-theme="dark"] .status-notes-wrap label,
html[data-theme="dark"] .owner-status-notes label,
html[data-theme="dark"] form:has([name="action"][value*="status"]) label,
html[data-theme="dark"] form:has(textarea[name="update_text"]) label,
html[data-theme="dark"] form:has(textarea[name*="status_update"]) label,
html[data-theme="dark"] form:has(textarea[name*="status_note"]) label {
    color: #aab6c4 !important;
}


/* Restore and preserve dashboard owner-priority highlights.
   These are intentionally last so no generic surface rule can override them. */
html[data-theme="dark"] tbody tr[style*="background:#e8f5e9"],
html[data-theme="dark"] tbody tr[style*="background: #e8f5e9"] {
    background: #173223 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#fff3cd"],
html[data-theme="dark"] tbody tr[style*="background: #fff3cd"] {
    background: #3b3118 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#f8d7da"],
html[data-theme="dark"] tbody tr[style*="background: #f8d7da"] {
    background: #3b1f24 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#e8f5e9"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #e8f5e9"]:hover {
    background: #1d402b !important;
}

html[data-theme="dark"] tbody tr[style*="background:#fff3cd"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #fff3cd"]:hover {
    background: #493c1b !important;
}

html[data-theme="dark"] tbody tr[style*="background:#f8d7da"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #f8d7da"]:hover {
    background: #48262c !important;
}

/* ===== Wrapper-specific correction: Assigned Projects and Status Notes composer ===== */

/*
 * Assigned Projects:
 * The project label itself is already dark. The remaining white strip is
 * the immediate list/card wrapper surrounding that label.
 */
html[data-theme="dark"] div:has(input[type="checkbox"][name*="project"])
    :is(.project-list, .projects-list, .assigned-projects, .assigned-project-list,
        .project-checkbox-list, .project-selection-list),
html[data-theme="dark"] :is(.project-list, .projects-list, .assigned-projects,
    .assigned-project-list, .project-checkbox-list, .project-selection-list)
    :is(div, label):has(input[type="checkbox"]),
html[data-theme="dark"] :is(div, fieldset, li)
    :has(input[type="checkbox"][name*="project"])
    :not(:has(:is(div, fieldset, li) input[type="checkbox"][name*="project"])),
html[data-theme="dark"] :is(div, fieldset, li)
    :has(input[type="checkbox"][name*="assigned"])
    :not(:has(:is(div, fieldset, li) input[type="checkbox"][name*="assigned"])) {
    background: #1d2833 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

/*
 * Match both common project checkbox name patterns even when the checkbox
 * is nested inside another element instead of being a direct label child.
 */
html[data-theme="dark"] label:has(input[type="checkbox"][name*="project"]),
html[data-theme="dark"] label:has(input[type="checkbox"][name*="assigned"]) {
    background: #1d2833 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] label:has(input[type="checkbox"][name*="project"]) small,
html[data-theme="dark"] label:has(input[type="checkbox"][name*="assigned"]) small,
html[data-theme="dark"] label:has(input[type="checkbox"][name*="project"]) .subtle,
html[data-theme="dark"] label:has(input[type="checkbox"][name*="assigned"]) .subtle {
    color: #aab6c4 !important;
}


/*
 * Status Notes composer:
 * The white area is the form/wrapper containing a datetime-local control
 * and the status-update textarea. This targets only that combination.
 */
html[data-theme="dark"] form:has(input[type="datetime-local"]):has(textarea),
html[data-theme="dark"] form:has(input[type="date"]):has(textarea[name*="status"]),
html[data-theme="dark"] :is(div, section, article)
    :has(> form:has(input[type="datetime-local"]):has(textarea)),
html[data-theme="dark"] :is(div, section, article)
    :has(input[type="datetime-local"]):has(textarea)
    :not(:has(:is(div, section, article) input[type="datetime-local"])) {
    background: #18212b !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] form:has(input[type="datetime-local"]):has(textarea) label,
html[data-theme="dark"] form:has(input[type="date"]):has(textarea[name*="status"]) label {
    color: #aab6c4 !important;
}

html[data-theme="dark"] form:has(input[type="datetime-local"]):has(textarea)
    input[type="datetime-local"],
html[data-theme="dark"] form:has(input[type="date"]):has(textarea[name*="status"])
    input[type="date"],
html[data-theme="dark"] form:has(input[type="datetime-local"]):has(textarea) textarea,
html[data-theme="dark"] form:has(input[type="date"]):has(textarea[name*="status"]) textarea {
    background: #111a23 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}


/*
 * Priority rows remain last and explicit so these wrapper corrections
 * cannot interfere with dashboard highlighting.
 */
html[data-theme="dark"] tbody tr[style*="background:#e8f5e9"],
html[data-theme="dark"] tbody tr[style*="background: #e8f5e9"] {
    background: #173223 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#fff3cd"],
html[data-theme="dark"] tbody tr[style*="background: #fff3cd"] {
    background: #3b3118 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#f8d7da"],
html[data-theme="dark"] tbody tr[style*="background: #f8d7da"] {
    background: #3b1f24 !important;
}

html[data-theme="dark"] tbody tr[style*="background:#e8f5e9"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #e8f5e9"]:hover {
    background: #1d402b !important;
}

html[data-theme="dark"] tbody tr[style*="background:#fff3cd"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #fff3cd"]:hover {
    background: #493c1b !important;
}

html[data-theme="dark"] tbody tr[style*="background:#f8d7da"]:hover,
html[data-theme="dark"] tbody tr[style*="background: #f8d7da"]:hover {
    background: #48262c !important;
}

/* ===== JavaScript-assisted precise fixes ===== */

/*
 * theme.js adds these classes after locating the exact controls.
 * These selectors do not target tables or dashboard owner rows.
 */
html[data-theme="dark"] .theme-assigned-projects-wrapper,
html[data-theme="dark"] .theme-assigned-project-card {
    background: #1d2833 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] .theme-assigned-projects-wrapper {
    border-radius: 8px;
}

html[data-theme="dark"] .theme-assigned-project-card:hover {
    background: #243442 !important;
    border-color: #607488 !important;
}

html[data-theme="dark"] .theme-assigned-projects-wrapper small,
html[data-theme="dark"] .theme-assigned-project-card small,
html[data-theme="dark"] .theme-assigned-projects-wrapper .subtle,
html[data-theme="dark"] .theme-assigned-project-card .subtle {
    color: #aab6c4 !important;
}

html[data-theme="dark"] .theme-assigned-projects-wrapper input[type="checkbox"],
html[data-theme="dark"] .theme-assigned-project-card input[type="checkbox"] {
    accent-color: #6eafe7;
}


/* Exact Status Notes composer selected by theme.js */
html[data-theme="dark"] .theme-status-notes-composer {
    background: #18212b !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] .theme-status-notes-composer label,
html[data-theme="dark"] .theme-status-notes-composer .label,
html[data-theme="dark"] .theme-status-notes-composer [class*="label"] {
    color: #aab6c4 !important;
}

html[data-theme="dark"] .theme-status-notes-composer input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .theme-status-notes-composer textarea,
html[data-theme="dark"] .theme-status-notes-composer select {
    background: #111a23 !important;
    color: #e7edf4 !important;
    border-color: #465566 !important;
}

html[data-theme="dark"] .theme-status-notes-composer input::placeholder,
html[data-theme="dark"] .theme-status-notes-composer textarea::placeholder {
    color: #8794a3 !important;
    opacity: 1;
}

/* ===== Dark-mode completed-document action buttons ===== */

/*
 * Owner-page document actions receive the "success" class when a file exists.
 * This rule is intentionally more specific than the ordinary dark-mode
 * .btn rule so Appraisal, Title Search, Map, Just Compensation,
 * Administrative Settlement, RPI, TP-584, Contact Diary, and similar
 * completed-file actions remain visibly green.
 */
html[data-theme="dark"] .action-list .btn.success,
html[data-theme="dark"] a.btn.success,
html[data-theme="dark"] button.btn.success,
html[data-theme="dark"] input.btn.success {
    background: #1f7a4d !important;
    color: #ffffff !important;
    border-color: #49b97d !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .action-list .btn.success:hover,
html[data-theme="dark"] a.btn.success:hover,
html[data-theme="dark"] button.btn.success:hover,
html[data-theme="dark"] input.btn.success:hover {
    background: #278b5a !important;
    color: #ffffff !important;
    border-color: #68d19a !important;
}

html[data-theme="dark"] .action-list .btn.success:focus-visible,
html[data-theme="dark"] a.btn.success:focus-visible,
html[data-theme="dark"] button.btn.success:focus-visible,
html[data-theme="dark"] input.btn.success:focus-visible {
    outline: 3px solid rgba(104, 209, 154, 0.35);
    outline-offset: 2px;
}

/* ===== Definitive completed-document button override ===== */

/*
 * The ordinary dark-mode .btn selector now explicitly excludes .success.
 * This higher-specificity rule is retained as a defensive safeguard.
 */
html[data-theme="dark"] .action-list a.btn.success:not(.primary):not(.danger):not(.active):not(.document-open),
html[data-theme="dark"] .action-list button.btn.success:not(.primary):not(.danger):not(.active):not(.document-open) {
    background-color: #22c55e !important;
    background-image: none !important;
    color: #ffffff !important;
    border-color: #22c55e !important;
}

html[data-theme="dark"] .action-list a.btn.success:not(.primary):not(.danger):not(.active):not(.document-open):hover,
html[data-theme="dark"] .action-list button.btn.success:not(.primary):not(.danger):not(.active):not(.document-open):hover {
    background-color: #16a34a !important;
    background-image: none !important;
    color: #ffffff !important;
    border-color: #4ade80 !important;
}
