/* PMRT central readability/contrast baseline
 * Registry lists: wrap the table in .pmrt-registry-shell.pmrt-registry and use table.vibe-table
 *   (or Bootstrap table.table inside .pmrt-registry for legacy screens). See user_management.php, vibe_equipment.php. */
:root {
    /* Base PMRT theme tokens used across all pages */
    --pmrt-bg: #0a0e14;
    --pmrt-nav: linear-gradient(135deg, #121a24 0%, #0a0e14 100%);
    --pmrt-accent: var(--pmrt-color-accent, #00d4aa);
    --pmrt-accent-dim: rgba(0, 212, 170, 0.2);
    --pmrt-text: #e6edf3;
    --pmrt-text-muted: rgba(230, 237, 243, 0.85);
    --pmrt-border: rgba(255, 255, 255, 0.08);
    --pmrt-card: #161b22;
    --pmrt-hover: rgba(0, 212, 170, 0.12);

    /* Core palette tokens (single-point palette switching) */
    --pmrt-color-primary: #800000;
    --pmrt-color-primary-hover: #a00000;
    --pmrt-color-accent: #00d4aa;
    --pmrt-color-accent-hover: #00c19c;
    --pmrt-color-accent-soft: #a7f3d0;
    --pmrt-color-success: #4ade80;
    --pmrt-color-danger: #f87171;
    --pmrt-color-danger-soft: #fca5a5;
    --pmrt-color-surface-strong: #111827;
    --pmrt-color-surface-mid: #374151;
    --pmrt-color-surface-muted: #4b5563;
    --pmrt-color-text-on-dark: #ffffff;

    --pmrt-readable-text: #111827;
    --pmrt-readable-muted: #6b7280;
    --pmrt-input-bg: #ffffff;
    --pmrt-input-border: #cbd5e1;
}

/* Global typography rhythm for all pmrt-theme pages */
body.pmrt-theme {
    font-family: "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}
body.pmrt-theme h1,
body.pmrt-theme h2,
body.pmrt-theme h3,
body.pmrt-theme h4,
body.pmrt-theme h5,
body.pmrt-theme h6 {
    letter-spacing: 0.01em;
    font-weight: 700;
}
body.pmrt-theme h1 { font-size: 1.9rem; }
body.pmrt-theme h2 { font-size: 1.6rem; }
body.pmrt-theme h3 { font-size: 1.35rem; }
body.pmrt-theme h4 { font-size: 1.15rem; }
body.pmrt-theme h5 { font-size: 1rem; }
body.pmrt-theme h6 { font-size: 0.9rem; }
body.pmrt-theme .form-label,
body.pmrt-theme label {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
body.pmrt-theme .btn {
    font-weight: 600;
}

body.pmrt-theme .text-muted,
body.pmrt-theme .text-secondary {
    color: var(--pmrt-readable-muted) !important;
}

/* Keep forms legible on light cards/modals shown over dark theme pages */
body.pmrt-theme .modal-content,
body.pmrt-theme .card,
body.pmrt-theme .table-responsive {
    color: var(--pmrt-readable-text);
}

body.pmrt-theme .modal-content label,
body.pmrt-theme .modal-content .form-label,
body.pmrt-theme .card label,
body.pmrt-theme .card .form-label {
    color: var(--pmrt-color-surface-mid) !important;
    font-weight: 600;
}

body.pmrt-theme .modal-content .form-control,
body.pmrt-theme .modal-content .form-select,
body.pmrt-theme .card .form-control,
body.pmrt-theme .card .form-select {
    background: var(--pmrt-input-bg) !important;
    border-color: var(--pmrt-input-border) !important;
    color: var(--pmrt-readable-text) !important;
}

body.pmrt-theme .modal-content .form-control::placeholder,
body.pmrt-theme .modal-content textarea::placeholder,
body.pmrt-theme .card .form-control::placeholder,
body.pmrt-theme .card textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1;
}

/*
 * Dark inline forms (work orders, contracts, POs, ROI filters, equipment filters):
 * inputs use dark backgrounds — placeholders must stay light enough to read.
 */
body.pmrt-theme .wo-card .form-control::placeholder,
body.pmrt-theme .wo-card textarea::placeholder,
body.pmrt-theme .card-box .form-control::placeholder,
body.pmrt-theme .card-box textarea::placeholder,
body.pmrt-theme .filter-panel .form-control::placeholder,
body.pmrt-theme .filter-panel textarea::placeholder,
body.pmrt-theme .pmrt-filter-bar .form-control::placeholder {
    color: rgba(230, 237, 243, 0.58) !important;
    opacity: 1;
}

/* Improve low-contrast outlined controls across pages */
body.pmrt-theme .btn-outline-dark {
    color: var(--pmrt-color-surface-strong) !important;
    border-color: var(--pmrt-color-surface-mid) !important;
}
body.pmrt-theme .btn-outline-dark:hover {
    color: var(--pmrt-color-text-on-dark) !important;
    background: var(--pmrt-color-surface-strong) !important;
    border-color: var(--pmrt-color-surface-strong) !important;
}

body.pmrt-theme .btn-outline-secondary {
    color: var(--pmrt-color-surface-mid) !important;
    border-color: #6b7280 !important;
}
body.pmrt-theme .btn-outline-secondary:hover {
    color: var(--pmrt-color-text-on-dark) !important;
    background: var(--pmrt-color-surface-muted) !important;
    border-color: var(--pmrt-color-surface-muted) !important;
}

/* -------------------------------------------------------------------------
   Registry data grids (user management, equipment, jobs, ROI, etc.)
   Maroon header, dark card body, subtle row stripes — matches Team / Users list.
   Use: wrap table in .pmrt-registry; table class="vibe-table" (no Bootstrap .table).
   ------------------------------------------------------------------------- */
body.pmrt-theme .pmrt-registry .vibe-table,
body.pmrt-theme .user-management-page .vibe-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--pmrt-card);
    color: var(--pmrt-text);
}
body.pmrt-theme .pmrt-registry .vibe-table caption,
body.pmrt-theme .user-management-page .vibe-table caption {
    caption-side: top;
    background: var(--pmrt-color-primary);
    color: var(--pmrt-color-text-on-dark);
    padding: 10px 14px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    text-align: left;
}
body.pmrt-theme .pmrt-registry .vibe-table thead th,
body.pmrt-theme .user-management-page .vibe-table thead th {
    background: var(--pmrt-color-primary);
    color: var(--pmrt-color-text-on-dark);
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
body.pmrt-theme .pmrt-registry .vibe-table tbody td,
body.pmrt-theme .user-management-page .vibe-table tbody td {
    border: 1px solid var(--pmrt-border);
    padding: 8px 12px;
    color: var(--pmrt-text) !important;
    vertical-align: middle;
}
body.pmrt-theme .pmrt-registry .vibe-table tbody tr:nth-child(even) td,
body.pmrt-theme .user-management-page .vibe-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.04);
    color: var(--pmrt-text) !important;
}
body.pmrt-theme .pmrt-registry .vibe-table tbody tr:nth-child(odd) td,
body.pmrt-theme .user-management-page .vibe-table tbody tr:nth-child(odd) td {
    background: transparent;
    color: var(--pmrt-text) !important;
}
body.pmrt-theme .pmrt-registry .vibe-table tbody tr:hover td,
body.pmrt-theme .user-management-page .vibe-table tbody tr:hover td {
    background: rgba(0, 212, 170, 0.06);
}
body.pmrt-theme .user-management-page .vibe-table tbody tr.user-row-inactive td {
    background: rgba(0, 0, 0, 0.28);
    color: var(--pmrt-text-muted) !important;
}
body.pmrt-theme .user-management-page .vibe-table tbody tr.user-row-inactive td .text-muted {
    color: rgba(230, 237, 243, 0.65) !important;
}
body.pmrt-theme .pmrt-registry .vibe-table .text-muted,
body.pmrt-theme .user-management-page .vibe-table .text-muted {
    color: rgba(230, 237, 243, 0.72) !important;
}
body.pmrt-theme .pmrt-registry .vibe-table code,
body.pmrt-theme .user-management-page .vibe-table code {
    color: var(--pmrt-accent) !important;
    background: rgba(0, 212, 170, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}
body.pmrt-theme .pmrt-registry .vibe-table .text-danger,
body.pmrt-theme .user-management-page .vibe-table .text-danger {
    color: var(--pmrt-color-danger-soft) !important;
}
body.pmrt-theme .pmrt-registry .vibe-table .fw-bold,
body.pmrt-theme .pmrt-registry .vibe-table .fw-semibold {
    color: var(--pmrt-text) !important;
}
body.pmrt-theme .pmrt-registry .unit-label {
    color: var(--pmrt-color-danger) !important;
    font-weight: bold;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}
body.pmrt-theme .user-management-page .status-active {
    color: var(--pmrt-color-success) !important;
    font-weight: bold;
}
body.pmrt-theme .user-management-page .status-inactive {
    color: var(--pmrt-color-danger) !important;
    font-style: italic;
}

/* Registry shell + filter row (equipment, jobs, etc.) */
body.pmrt-theme .pmrt-registry-shell {
    border: 1px solid var(--pmrt-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--pmrt-card);
}
body.pmrt-theme .pmrt-filter-bar {
    background: var(--pmrt-card);
    border: 1px solid var(--pmrt-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
body.pmrt-theme .pmrt-filter-bar .form-label {
    color: rgba(230, 237, 243, 0.75) !important;
    font-size: 0.75rem;
}
body.pmrt-theme .pmrt-filter-bar .form-select,
body.pmrt-theme .pmrt-filter-bar .form-control {
    background: var(--pmrt-bg) !important;
    border: 1px solid var(--pmrt-border) !important;
    color: var(--pmrt-text) !important;
    font-size: 0.85rem;
}
body.pmrt-theme .pmrt-filter-bar .form-select:focus,
body.pmrt-theme .pmrt-filter-bar .form-control:focus {
    border-color: var(--pmrt-accent) !important;
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.2);
}
body.pmrt-theme .btn-pmrt-accent {
    background: var(--pmrt-color-accent);
    border-color: var(--pmrt-color-accent);
    color: #0f172a;
    font-weight: 700;
}
body.pmrt-theme .btn-pmrt-accent:hover {
    background: var(--pmrt-color-accent-hover);
    border-color: var(--pmrt-color-accent-hover);
    color: #0b1220;
}
body.pmrt-theme .btn-pmrt-muted {
    background: var(--pmrt-color-surface-mid);
    border-color: var(--pmrt-color-surface-mid);
    color: #f9fafb;
    font-weight: 600;
}
body.pmrt-theme .btn-pmrt-muted:hover {
    background: var(--pmrt-color-surface-strong);
    border-color: var(--pmrt-color-surface-strong);
    color: var(--pmrt-color-text-on-dark);
}

/* Bootstrap .table inside .pmrt-registry (legacy pages migrating to vibe-table) */
body.pmrt-theme .pmrt-registry table.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: rgba(0, 212, 170, 0.06);
    --bs-table-border-color: var(--pmrt-border);
    color: var(--pmrt-text);
    margin-bottom: 0;
}
body.pmrt-theme .pmrt-registry table.table thead th {
    background: var(--pmrt-color-primary) !important;
    color: var(--pmrt-color-text-on-dark) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    font-size: 0.75rem;
    font-weight: 600;
}
body.pmrt-theme .pmrt-registry table.table tbody td {
    background: transparent !important;
    color: var(--pmrt-text) !important;
    border-color: var(--pmrt-border) !important;
    vertical-align: middle;
}
body.pmrt-theme .pmrt-registry table.table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.pmrt-theme .pmrt-registry .vibe-table a.text-link-registry:not(.btn),
body.pmrt-theme .pmrt-registry .vibe-table a:not(.btn):not(.dropdown-item) {
    color: var(--pmrt-accent) !important;
    text-decoration: none;
}
body.pmrt-theme .pmrt-registry .vibe-table a.text-link-registry:hover,
body.pmrt-theme .pmrt-registry .vibe-table a:not(.btn):not(.dropdown-item):hover {
    color: var(--pmrt-color-accent-soft) !important;
    text-decoration: underline;
}
