/**
 * Dark mode overrides — /public/css (loaded via app.blade.php)
 */
[data-layout-mode=dark_mode] {
    --dm-bg: #12151a;
    --dm-surface: #1a1f27;
    --dm-surface-2: #232a35;
    --dm-surface-3: #2c3441;
    --dm-border: #2a3340;
    --dm-border-hover: #384353;
    --dm-text: #e8edf3;
    --dm-text-secondary: #9aa5b4;
    --dm-text-muted: #6b7785;
    --dm-accent: #4a8fd4;
    --dm-accent-soft: rgba(74, 143, 212, 0.16);
}

/* Inputs & search — dark borders (override light #dbe0e6 / PrimeVue theme) */
[data-layout-mode=dark_mode] .form-control,
[data-layout-mode=dark_mode] .p-inputtext,
[data-layout-mode=dark_mode] .search-set .search-input input,
[data-layout-mode=dark_mode] .search-set .search-input .form-control,
[data-layout-mode=dark_mode] .search-set .search-input .p-inputtext,
[data-layout-mode=dark_mode] .table-top .search-input .form-control,
[data-layout-mode=dark_mode] .table-top .search-input .p-inputtext,
[data-layout-mode=dark_mode] .p-dropdown,
[data-layout-mode=dark_mode] .p-dropdown .p-dropdown-label,
[data-layout-mode=dark_mode] .p-dropdown .p-dropdown-trigger,
[data-layout-mode=dark_mode] .p-multiselect,
[data-layout-mode=dark_mode] .p-multiselect .p-multiselect-label {
    background: var(--dm-surface-3) !important;
    border: 1px solid var(--dm-border) !important;
    color: var(--dm-text) !important;
    outline: none !important;
    box-shadow: none !important;
}

[data-layout-mode=dark_mode] .p-inputtext:enabled:hover,
[data-layout-mode=dark_mode] .form-control:hover {
    border-color: var(--dm-border-hover) !important;
}

[data-layout-mode=dark_mode] .p-inputtext:enabled:focus,
[data-layout-mode=dark_mode] .form-control:focus {
    border-color: var(--dm-accent) !important;
    box-shadow: 0 0 0 2px var(--dm-accent-soft) !important;
}

/* Checkbox — table & forms (Bootstrap form-check-input reset) */
[data-layout-mode=dark_mode] .p-checkbox.form-check-input,
[data-layout-mode=dark_mode] .form-check-input.p-checkbox {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

[data-layout-mode=dark_mode] .p-checkbox .p-checkbox-box,
[data-layout-mode=dark_mode] .p-datatable .p-checkbox .p-checkbox-box {
    background: var(--dm-surface-2) !important;
    border: 1px solid var(--dm-border) !important;
    box-shadow: none !important;
    outline: none !important;
}

[data-layout-mode=dark_mode] .p-checkbox.p-highlight .p-checkbox-box,
[data-layout-mode=dark_mode] .p-datatable .p-checkbox.p-highlight .p-checkbox-box {
    background: var(--dm-accent) !important;
    border-color: var(--dm-accent) !important;
}

[data-layout-mode=dark_mode] .p-tabview .p-tabview-nav {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .p-tabview .p-tabview-nav li .p-tabview-nav-link {
    background: transparent !important;
    color: var(--dm-text-muted) !important;
}

[data-layout-mode=dark_mode] .p-tabview .p-tabview-nav li.p-highlight .p-tabview-nav-link {
    background: var(--dm-accent-soft) !important;
    color: var(--dm-accent) !important;
    border-color: var(--dm-accent) !important;
}

[data-layout-mode=dark_mode] .p-tabview .p-tabview-nav-content,
[data-layout-mode=dark_mode] .p-tabview .p-tabview-panels {
    background: var(--dm-surface) !important;
}

[data-layout-mode=dark_mode] .p-tabview .p-tabview-ink-bar {
    background: var(--dm-accent) !important;
}

[data-layout-mode=dark_mode] .p-datatable .p-datatable-thead > tr > th {
    background: var(--dm-surface-2) !important;
    color: var(--dm-text) !important;
    border: 1px solid var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .p-datatable .p-datatable-tbody > tr > td {
    background: var(--dm-surface) !important;
    color: var(--dm-text-secondary) !important;
    border: 1px solid var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .p-datatable.p-datatable-gridlines .p-datatable-thead > tr > th,
[data-layout-mode=dark_mode] .p-datatable.p-datatable-gridlines .p-datatable-tbody > tr > td,
[data-layout-mode=dark_mode] tbody,
[data-layout-mode=dark_mode] td,
[data-layout-mode=dark_mode] th,
[data-layout-mode=dark_mode] thead,
[data-layout-mode=dark_mode] tr {
    border-color: var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .tab-header button,
[data-layout-mode=dark_mode] .tab-page-header button,
[data-layout-mode=dark_mode] .tab-page-header .p-button {
    border: 1px solid var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .table-top-head li a,
[data-layout-mode=dark_mode] .table-top-head li #collapse-header {
    border: 1px solid var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .p-datatable .p-datatable-tbody > tr:hover > td {
    background: var(--dm-surface-2) !important;
}

[data-layout-mode=dark_mode] .p-dropdown-panel,
[data-layout-mode=dark_mode] .p-multiselect-panel {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

[data-layout-mode=dark_mode] .p-dropdown-item,
[data-layout-mode=dark_mode] .p-multiselect-item {
    color: var(--dm-text-secondary) !important;
}

[data-layout-mode=dark_mode] .p-dropdown-item.p-highlight,
[data-layout-mode=dark_mode] .p-dropdown-item:not(.p-highlight):not(.p-disabled):hover {
    background: var(--dm-surface-2) !important;
    color: var(--dm-text) !important;
}

/* Residual overlay/panel normalization */
[data-layout-mode=dark_mode] .p-dialog .p-dialog-content,
[data-layout-mode=dark_mode] .p-dialog .p-dialog-header,
[data-layout-mode=dark_mode] .p-dialog .p-dialog-footer,
[data-layout-mode=dark_mode] .p-overlaypanel .p-overlaypanel-content,
[data-layout-mode=dark_mode] .p-component-overlay {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-secondary) !important;
}

/* Auth — mirrors dark-mode-components.css (loaded via Vite on SPA pages) */
html[data-layout-mode=dark_mode] .login-wrapper .login-content.user-login .login-userset {
    background: var(--dm-surface) !important;
    border: 1px solid var(--dm-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
}

html[data-layout-mode=dark_mode] .login-wrapper .login-content .form-login .forgot-link {
    color: var(--dm-accent) !important;
}

html[data-layout-mode=dark_mode] .login-wrapper .login-content .form-login .btn-login {
    background: linear-gradient(135deg, #4a8fd4 0%, #3d7ab8 100%) !important;
    border-color: rgba(91, 159, 212, 0.35) !important;
    color: #fff !important;
}

html[data-layout-mode=dark_mode] .login-wrapper .form-check-label.remember-me,
html[data-layout-mode=dark_mode] .login-wrapper label.checkboxs .form-check-label,
html[data-layout-mode=dark_mode] .login-wrapper label span.remember-me {
    color: var(--dm-text, #f1f5f9) !important;
}

/* List pages — status tabs (Expense, AR, Refund, etc.) */
html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav,
html[data-layout-mode=dark_mode] .nav.nav-tabs.page-header-tabs.p-tabview .p-tabview-nav,
html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav-content {
    background: var(--dm-surface) !important;
    border-color: var(--dm-border) !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav li .p-tabview-nav-link,
html[data-layout-mode=dark_mode] .nav.nav-tabs.page-header-tabs .p-tabview-nav li .p-tabview-nav-link {
    background: transparent !important;
    color: var(--dm-text-muted) !important;
    border-color: transparent !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav li.p-highlight,
html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav li.p-tabview-header.p-highlight,
html[data-layout-mode=dark_mode] .nav.nav-tabs.page-header-tabs .p-tabview-nav li.p-highlight {
    background: transparent !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav li.p-highlight .p-tabview-nav-link,
html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-nav li.p-tabview-header.p-highlight .p-tabview-nav-link,
html[data-layout-mode=dark_mode] .nav.nav-tabs.page-header-tabs .p-tabview-nav li.p-highlight .p-tabview-nav-link {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #60a5fa !important;
    font-weight: 600 !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35) !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs .p-tabview-nav li.p-highlight .fw-normal,
html[data-layout-mode=dark_mode] .page-header-tabs .p-tabview-header.p-highlight .fw-normal {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs .p-tabview-nav li:not(.p-highlight) .fw-normal {
    color: var(--dm-text-muted) !important;
}

/* DataTable footer row (Total: ₱ …) */
html[data-layout-mode=dark_mode] .p-datatable .p-datatable-tfoot > tr > td,
html[data-layout-mode=dark_mode] .p-datatable tfoot > tr > td,
html[data-layout-mode=dark_mode] .datatable-custom .p-datatable-tfoot > tr > td {
    background: var(--dm-surface-2) !important;
    color: var(--dm-text-secondary) !important;
    border: 1px solid var(--dm-border) !important;
}

html[data-layout-mode=dark_mode] .p-datatable .p-datatable-tfoot > tr > td .text-bold,
html[data-layout-mode=dark_mode] .p-datatable .p-datatable-tfoot > tr > td.text-bold {
    color: var(--dm-text) !important;
}

html[data-layout-mode=dark_mode] .bg-light-yellow,
html[data-layout-mode=dark_mode] .p-datatable .p-datatable-tfoot .bg-light-yellow,
html[data-layout-mode=dark_mode] .p-datatable tfoot .bg-light-yellow {
    background: rgba(74, 143, 212, 0.14) !important;
    color: var(--dm-accent) !important;
}

/* Transaction — tabs (light style: muted label + accent underline on active text) */
html[data-layout-mode=dark_mode] .production_staff .tabs .p-button,
html[data-layout-mode=dark_mode] .production_staff .tabs button,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button,
html[data-layout-mode=dark_mode] .ofd_staff .tabs button {
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--dm-text-muted) !important;
    padding: 0.5rem 0.85rem !important;
    min-width: auto !important;
}

html[data-layout-mode=dark_mode] .production_staff .tabs .p-button .fw-normal,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button .fw-normal,
html[data-layout-mode=dark_mode] .production_staff .tabs button .fw-normal,
html[data-layout-mode=dark_mode] .ofd_staff .tabs button .fw-normal {
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    color: var(--dm-text-muted) !important;
    display: inline-block !important;
    padding-bottom: 4px !important;
    line-height: 1.25 !important;
}

html[data-layout-mode=dark_mode] .production_staff .tabs .p-button.active,
html[data-layout-mode=dark_mode] .production_staff .tabs button.active,
html[data-layout-mode=dark_mode] .production_staff .tabs .active.p-button,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button.active,
html[data-layout-mode=dark_mode] .ofd_staff .tabs button.active,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .active.p-button {
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    color: var(--dm-text) !important;
    box-shadow: none !important;
}

html[data-layout-mode=dark_mode] .production_staff .tabs .p-button.active .fw-normal,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button.active .fw-normal,
html[data-layout-mode=dark_mode] .production_staff .tabs button.active .fw-normal,
html[data-layout-mode=dark_mode] .ofd_staff .tabs button.active .fw-normal {
    color: var(--dm-text) !important;
    border-bottom: 3px solid var(--dm-accent) !important;
    font-weight: 500 !important;
}

html[data-layout-mode=dark_mode] .production_staff .tabs .p-button:not(.active):hover,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button:not(.active):hover {
    background: transparent !important;
    color: var(--dm-text-secondary) !important;
}

html[data-layout-mode=dark_mode] .production_staff .tabs .p-button:not(.active):hover .fw-normal,
html[data-layout-mode=dark_mode] .ofd_staff .tabs .p-button:not(.active):hover .fw-normal {
    color: var(--dm-text-secondary) !important;
}

html[data-layout-mode=dark_mode] .page-header-tabs.p-tabview .p-tabview-ink-bar,
html[data-layout-mode=dark_mode] .nav.nav-tabs.page-header-tabs.p-tabview .p-tabview-ink-bar {
    display: none !important;
    height: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
}
