/* KTG CONSTRUCTION MANAGEMENT — DARK VIP PRO SCOPE FIX
 * Corrects the legacy dark compatibility layer for the actual app layout.
 * The application content is wrapped by .triton-page rather than <main>.
 * Presentation only: no workflow, route, Livewire or business logic changes.
 */

html.dark {
    --ktg-v2-canvas: #07111f;
    --ktg-v2-surface: #0f1b2c;
    --ktg-v2-surface-2: #142238;
    --ktg-v2-surface-3: #18283d;
    --ktg-v2-surface-4: #1d3048;
    --ktg-v2-border: #2d415a;
    --ktg-v2-border-soft: #22344b;
    --ktg-v2-text: #f5f8fc;
    --ktg-v2-text-2: #d3deea;
    --ktg-v2-text-3: #a9b8ca;
    --ktg-v2-text-4: #8296af;
    --ktg-v2-blue: #9fc8f7;
    --ktg-v2-gold: #f2b84b;
}

/* --------------------------------------------------------------------------
   Actual application content scope
   -------------------------------------------------------------------------- */
html.dark body .triton-page {
    color: var(--ktg-v2-text-2) !important;
}

html.dark body .triton-page .triton-card,
html.dark body .triton-page [class~="bg-white"],
html.dark body .triton-page [class*="bg-white/"],
html.dark body .triton-page [class*="bg-[#ffffff]"],
html.dark body .triton-page [class*="bg-[#FFFFFF]"] {
    background-color: var(--ktg-v2-surface) !important;
    border-color: var(--ktg-v2-border) !important;
    color: var(--ktg-v2-text-2) !important;
}

html.dark body .triton-page [class~="bg-slate-50"],
html.dark body .triton-page [class*="bg-slate-50/"],
html.dark body .triton-page [class~="bg-slate-100"],
html.dark body .triton-page [class*="bg-slate-100/"],
html.dark body .triton-page [class*="bg-[#f8fafc]"],
html.dark body .triton-page [class*="bg-[#F8FAFC]"],
html.dark body .triton-page [class*="bg-[#f1f5f9]"],
html.dark body .triton-page [class*="bg-[#F1F5F9]"] {
    background-color: var(--ktg-v2-surface-2) !important;
}

html.dark body .triton-page [class~="bg-slate-200"],
html.dark body .triton-page [class*="bg-slate-200/"],
html.dark body .triton-page [class~="bg-slate-300"],
html.dark body .triton-page [class*="bg-slate-300/"] {
    background-color: var(--ktg-v2-surface-3) !important;
}

/* --------------------------------------------------------------------------
   Typography — eliminate navy-on-navy / grey-on-grey failures
   -------------------------------------------------------------------------- */
html.dark body .triton-page h1,
html.dark body .triton-page h2,
html.dark body .triton-page h3,
html.dark body .triton-page h4,
html.dark body .triton-page h5,
html.dark body .triton-page h6,
html.dark body .triton-page [class~="text-slate-950"],
html.dark body .triton-page [class~="text-slate-900"],
html.dark body .triton-page [class~="text-slate-800"] {
    color: var(--ktg-v2-text) !important;
}

html.dark body .triton-page [class~="text-slate-700"] {
    color: #dbe5f0 !important;
}

html.dark body .triton-page [class~="text-slate-600"] {
    color: #c4d0de !important;
}

html.dark body .triton-page [class~="text-slate-500"] {
    color: var(--ktg-v2-text-3) !important;
}

html.dark body .triton-page [class~="text-slate-400"] {
    color: var(--ktg-v2-text-4) !important;
}

html.dark body .triton-page [class~="text-slate-300"] {
    color: #b8c6d7 !important;
}

html.dark body .triton-page [class*="text-[#1D3C6A]"],
html.dark body .triton-page [class*="text-[#1d3c6a]"],
html.dark body .triton-page [class*="text-[#173A66]"],
html.dark body .triton-page [class*="text-[#244D82]"] {
    color: #dceaff !important;
}

html.dark body .triton-page a[class*="text-[#1D3C6A]"],
html.dark body .triton-page a[class*="text-[#1d3c6a]"] {
    color: var(--ktg-v2-blue) !important;
}

html.dark body .triton-page [class*="text-[#EBA93B]"],
html.dark body .triton-page [class*="text-[#F2B84B]"] {
    color: var(--ktg-v2-gold) !important;
}

/* --------------------------------------------------------------------------
   Borders, separators and rings
   -------------------------------------------------------------------------- */
html.dark body .triton-page [class~="border-slate-100"],
html.dark body .triton-page [class~="border-slate-200"],
html.dark body .triton-page [class~="border-slate-300"],
html.dark body .triton-page [class*="border-slate-100/"],
html.dark body .triton-page [class*="border-slate-200/"] {
    border-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page [class~="divide-slate-100"] > :not([hidden]) ~ :not([hidden]),
html.dark body .triton-page [class~="divide-slate-200"] > :not([hidden]) ~ :not([hidden]),
html.dark body .triton-page [class~="divide-slate-300"] > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--ktg-v2-border-soft) !important;
}

/* --------------------------------------------------------------------------
   Tables — executive dark register, never white header bands
   -------------------------------------------------------------------------- */
html.dark body .triton-page table {
    color: var(--ktg-v2-text-2) !important;
}

html.dark body .triton-page table thead,
html.dark body .triton-page table thead tr,
html.dark body .triton-page table thead th,
html.dark body .triton-page table thead [class~="bg-slate-50"],
html.dark body .triton-page table thead [class*="bg-slate-50/"] {
    background-color: var(--ktg-v2-surface-3) !important;
    color: #bdcada !important;
    border-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page table tbody,
html.dark body .triton-page table tbody tr,
html.dark body .triton-page table tbody td {
    background-color: transparent;
    border-color: var(--ktg-v2-border-soft) !important;
}

html.dark body .triton-page table tbody tr:hover,
html.dark body .triton-page tr[class*="hover:bg-slate-50"]:hover,
html.dark body .triton-page tr[class*="dark:hover:bg-slate-800"]:hover {
    background-color: #16283e !important;
}

/* --------------------------------------------------------------------------
   Inputs / filters / secondary actions
   -------------------------------------------------------------------------- */
html.dark body .triton-page input:not([type="checkbox"]):not([type="radio"]),
html.dark body .triton-page textarea,
html.dark body .triton-page select,
html.dark body .triton-page .triton-field {
    background-color: #0b1727 !important;
    border-color: #3a506c !important;
    color: #f0f5fb !important;
}

html.dark body .triton-page input::placeholder,
html.dark body .triton-page textarea::placeholder {
    color: #7f93ab !important;
    opacity: 1 !important;
}

html.dark body .triton-page input:focus,
html.dark body .triton-page textarea:focus,
html.dark body .triton-page select:focus,
html.dark body .triton-page .triton-field:focus {
    border-color: #6f9acb !important;
    box-shadow: 0 0 0 3px rgba(87, 139, 199, .16) !important;
}

html.dark body .triton-page select option {
    background: #101c2d !important;
    color: #eff5fb !important;
}

html.dark body .triton-page .triton-btn-secondary,
html.dark body .triton-page button[class*="bg-white"],
html.dark body .triton-page a[class*="bg-white"]:not([class*="rounded-full"]) {
    background: #132238 !important;
    border-color: #39506d !important;
    color: #eef5fc !important;
}

html.dark body .triton-page .triton-btn-secondary:hover {
    background: #1a2d46 !important;
    border-color: #527092 !important;
}

/* --------------------------------------------------------------------------
   Semantic soft surfaces: meaningful but never fluorescent / white
   -------------------------------------------------------------------------- */
html.dark body .triton-page [class~="bg-blue-50"],
html.dark body .triton-page [class*="bg-blue-50/"] {
    background-color: rgba(37, 99, 235, .15) !important;
}
html.dark body .triton-page [class~="text-blue-700"],
html.dark body .triton-page [class~="text-blue-600"] { color: #8fc3ff !important; }

html.dark body .triton-page [class~="bg-emerald-50"],
html.dark body .triton-page [class*="bg-emerald-50/"] {
    background-color: rgba(16, 185, 129, .13) !important;
}
html.dark body .triton-page [class~="text-emerald-700"],
html.dark body .triton-page [class~="text-emerald-600"] { color: #63e2b4 !important; }

html.dark body .triton-page [class~="bg-amber-50"],
html.dark body .triton-page [class*="bg-amber-50/"] {
    background-color: rgba(245, 158, 11, .14) !important;
}
html.dark body .triton-page [class~="text-amber-700"],
html.dark body .triton-page [class~="text-amber-600"] { color: #ffc762 !important; }

html.dark body .triton-page [class~="bg-red-50"],
html.dark body .triton-page [class*="bg-red-50/"] {
    background-color: rgba(239, 68, 68, .13) !important;
}
html.dark body .triton-page [class~="text-red-700"],
html.dark body .triton-page [class~="text-red-600"] { color: #ff929d !important; }

html.dark body .triton-page [class~="bg-violet-50"],
html.dark body .triton-page [class*="bg-violet-50/"] {
    background-color: rgba(139, 92, 246, .14) !important;
}
html.dark body .triton-page [class~="text-violet-700"],
html.dark body .triton-page [class~="text-violet-600"] { color: #c9b3ff !important; }

/* Neutral pills should be dark executive chips, not bright white capsules. */
html.dark body .triton-page [class~="bg-slate-100"][class*="rounded-full"],
html.dark body .triton-page [class~="bg-slate-100"][class*="rounded-lg"],
html.dark body .triton-page [class~="bg-slate-50"][class*="rounded-full"] {
    background-color: #1b2d44 !important;
    border-color: #3a506b !important;
    color: #dce6f1 !important;
}

/* --------------------------------------------------------------------------
   Dashboard — resource + QA/QC blocks from current screenshots
   -------------------------------------------------------------------------- */
html.dark body .triton-page #resource-summary .grid.gap-px,
html.dark body .triton-page #quality-summary .grid.gap-px {
    background-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page #resource-summary .grid.gap-px > *,
html.dark body .triton-page #quality-summary .grid.gap-px > * {
    background-color: #16263a !important;
    border-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page #resource-summary [class*="bg-slate-50/70"],
html.dark body .triton-page #quality-summary [class*="bg-slate-50/70"] {
    background-color: #15253a !important;
}

html.dark body .triton-page #resource-summary h2,
html.dark body .triton-page #resource-summary h3,
html.dark body .triton-page #quality-summary h2,
html.dark body .triton-page #quality-summary h3 {
    color: #f5f8fc !important;
}

html.dark body .triton-page #quality-summary > div:last-child[class*="bg-slate"],
html.dark body .triton-page #resource-summary > aside > div:last-child {
    background-color: #14243a !important;
}

/* --------------------------------------------------------------------------
   Structure page — floor cards + above-ground table
   -------------------------------------------------------------------------- */
html.dark body .triton-page .structure-item[class*="bg-white"] {
    background-color: #101d2f !important;
    border-color: #2b4059 !important;
}

html.dark body .triton-page .structure-item:hover {
    background-color: #16283e !important;
    border-color: #456589 !important;
}

html.dark body .triton-page .structure-tab:not([class*="bg-kt-navy"]):not([class*="bg-[#1D3C6A]"]) {
    background-color: #1a2b41 !important;
    color: #c9d5e2 !important;
}

/* --------------------------------------------------------------------------
   Owner payment / QS register — remove white islands and alternating light row
   -------------------------------------------------------------------------- */
html.dark body .triton-page section.grid > div[class*="grid-cols-2"][class*="bg-white"],
html.dark body .triton-page section.grid > div[class*="overflow-hidden"][class*="bg-white"] {
    background-color: #101d2f !important;
    border-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page section.grid > div[class*="grid-cols-2"][class*="bg-white"] > *,
html.dark body .triton-page section.grid > div[class*="overflow-hidden"][class*="bg-white"] > * {
    background-color: transparent !important;
    border-color: var(--ktg-v2-border) !important;
}

html.dark body .triton-page a[class*="hover:bg-slate-50"],
html.dark body .triton-page a[class*="hover:bg-red-50"],
html.dark body .triton-page a[class*="hover:bg-amber-50"] {
    border-color: var(--ktg-v2-border-soft) !important;
}

html.dark body .triton-page a[class*="hover:bg-slate-50"]:hover,
html.dark body .triton-page a[class*="hover:bg-red-50"]:hover,
html.dark body .triton-page a[class*="hover:bg-amber-50"]:hover {
    background-color: #16283e !important;
}

html.dark body .triton-page [class*="bg-red-50/20"],
html.dark body .triton-page [class*="bg-red-50/50"] {
    background-color: rgba(190, 30, 45, .09) !important;
}

html.dark body .triton-page [class*="bg-amber-50/20"],
html.dark body .triton-page [class*="bg-amber-50/50"] {
    background-color: rgba(217, 119, 6, .09) !important;
}

/* Dense value cells inside owner-payment rows should be dark, not light grey. */
html.dark body .triton-page [class~="bg-slate-100"][class*="rounded-xl"],
html.dark body .triton-page [class~="bg-slate-200"][class*="rounded-xl"] {
    background-color: #1a2a40 !important;
    border: 1px solid #30455f !important;
}

/* --------------------------------------------------------------------------
   Dialogs outside .triton-page — generic fallback
   -------------------------------------------------------------------------- */
html.dark body dialog,
html.dark body [role="dialog"],
html.dark body [data-flux-modal] {
    background-color: #101c2d !important;
    border-color: var(--ktg-v2-border) !important;
    color: var(--ktg-v2-text-2) !important;
}

html.dark body dialog [class~="bg-white"],
html.dark body dialog [class~="bg-slate-50"],
html.dark body dialog [class*="bg-slate-50/"] {
    background-color: #142338 !important;
    border-color: var(--ktg-v2-border) !important;
}

/* Keep scrollbar quiet and premium in dark mode. */
html.dark body .triton-page ::-webkit-scrollbar-thumb,
html.dark body dialog ::-webkit-scrollbar-thumb {
    background: #405a77 !important;
}

html.dark body .triton-page ::selection {
    background: rgba(90, 147, 211, .34);
    color: #fff;
}
