/* V7.7.11 — Complete light theme stabilization layer. Loaded last. Dark theme untouched. */
html[data-theme="light"]{color-scheme:light;background:#f3f5f7!important}
html[data-theme="light"] body{background:#f3f5f7!important;color:#171a20!important}
html[data-theme="light"] body.v5-body{background:#f3f5f7!important;color:#171a20!important}
html[data-theme="light"] body.v5-body .v5-main{background:#f3f5f7!important;color:#171a20!important}

/* Core readable typography */
html[data-theme="light"] body.v5-body .v5-main :where(h1,h2,h3,h4,h5,h6,p,label,legend,dt,dd,th,td){color:#171a20!important}
html[data-theme="light"] body.v5-body .v5-main :where(small,.muted,.sub,.hint,.pro-hint,.section-note,.field-hint,.form-hint,.help-text){color:#66717e!important}
html[data-theme="light"] body.v5-body .v5-main :where(.eyebrow,.section-kicker){color:#d71920!important}
html[data-theme="light"] body.v5-body .v5-main a:not(.btn):not([class*="badge"]):not([class*="chip"]){color:#1f5f99!important}

/* Generic surfaces: catch legacy dark cards/panels/forms that were not covered before */
html[data-theme="light"] body.v5-body .v5-main :where(
.panel,.unified-panel,.card,.pro-card,.quick-card,.activity-card,.status-summary,
[class$="-card"],[class*="-card "],[class$="-panel"],[class*="-panel "],
[class$="-box"],[class*="-box "],[class$="-surface"],[class*="-surface "],
[class$="-content"],[class*="-content "],[class$="-section"],[class*="-section "],
[class$="-summary"],[class*="-summary "],[class$="-details"],[class*="-details "],
[class$="-detail"],[class*="-detail "],[class$="-form"],[class*="-form "]
){background:#fff!important;background-image:none!important;color:#171a20!important;border-color:#dfe4ea!important;box-shadow:0 8px 24px rgba(16,24,40,.035)!important}

/* Known complex feature surfaces */
html[data-theme="light"] body.v5-body :where(
.ops-board,.ops-live-panel,.service-directory-pro,.customer-directory,.profile-card,
.field-card,.account-party-card,.maintenance-card,.company-directory-card,
.v57-services-summary a,.ops-board-row,.ops-board-toolbar,.ops-board-filterchips a,
.ops-status-strip>a,.ops-live-list>a,.v7-kpi,.v7-finance-strip a,.v7-block,.v7-list>a,
.metric-card,.workspace-grid>section,.workspace-grid>aside>*,.scale-table-row,.company-mobile-card,
.service-tab-panel,.service-panel,.service-form-card,.service-card,.reminder-card,
.v5-intake-card,.selected-customer,.v5-quick-customer,.v5-new-device,.device-history,.device-mode-bar,
.v5-intake-footer,.smart-results,.v5-smart-results,.history-placeholder,.mobile-recent-customers button,
.device-history-card,.lookup-work-grid>div,.lookup-finance,.lookup-item-list>div,.lookup-payment-summary>div,
.promise-mini-list article,.service-collection-items>div,.service-collection-buckets>div,
.field-item-list article,.field-finance-split>div,.field-payment-breakdown,
.account-master-card,.account-master-row,.account-master-timeline>a,.collection-customer,
.collection-job-list>a,.communication-log,.comm-card,.comm-panel,.maintenance-visit-card,
.company-card,.customer-card,.device-card,.warranty-card,.history-card,.report-card,.report-block,
.management-card,.settings-card,.user-card,.v60-user-card,.v60-activity-list>article,
.calendar-day,.calendar-job,.field-week-calendar,.field-day-card,.field-job-card,
.field-payment-card,.field-finance-card,.field-summary-card,.field-hero,.field-job-hero,
.detail-card,.detail-panel,.detail-section,.detail-grid>div,.detail-hero,.profile-hero-pro,
.lookup-result,.lookup-result-head,.lookup-result-body,.lookup-step,.lookup-item,.lookup-finance,
.service-command-metrics article,.device-command-metrics article,.history-metrics article,
.warranty-metrics article,.report-hero-grid article,.pro-kpi-grid a,.corp-kpis article,.archive-kpis article
){background:#fff!important;background-image:none!important;color:#171a20!important;border-color:#dfe4ea!important;box-shadow:0 8px 24px rgba(16,24,40,.035)!important}

/* Tables / lists / rows */
html[data-theme="light"] body.v5-body table{background:#fff!important;color:#171a20!important;border-color:#dfe4ea!important}
html[data-theme="light"] body.v5-body thead,
html[data-theme="light"] body.v5-body .service-row-head,
html[data-theme="light"] body.v5-body [class*="table-head"],
html[data-theme="light"] body.v5-body [class*="list-head"]{background:#f6f8fa!important;color:#59636f!important;border-color:#e4e8ed!important}
html[data-theme="light"] body.v5-body tbody tr,
html[data-theme="light"] body.v5-body .service-row,
html[data-theme="light"] body.v5-body [class*="table-row"],
html[data-theme="light"] body.v5-body [class*="list-row"]{background:#fff!important;color:#171a20!important;border-color:#e8ebef!important}
html[data-theme="light"] body.v5-body tbody tr:hover,
html[data-theme="light"] body.v5-body .service-row:hover,
html[data-theme="light"] body.v5-body [class*="table-row"]:hover,
html[data-theme="light"] body.v5-body [class*="list-row"]:hover{background:#f8fafc!important}
html[data-theme="light"] body.v5-body th{color:#66717e!important}
html[data-theme="light"] body.v5-body td{color:#171a20!important}

/* All editable form controls */
html[data-theme="light"] body.v5-body input,
html[data-theme="light"] body.v5-body select,
html[data-theme="light"] body.v5-body textarea,
html[data-theme="light"] body.v5-body [contenteditable="true"]{
 background:#fff!important;background-image:none!important;color:#171a20!important;
 border-color:#d5dce3!important;box-shadow:none!important
}
html[data-theme="light"] body.v5-body input::placeholder,
html[data-theme="light"] body.v5-body textarea::placeholder{color:#8b95a1!important;opacity:1!important}
html[data-theme="light"] body.v5-body input:focus,
html[data-theme="light"] body.v5-body select:focus,
html[data-theme="light"] body.v5-body textarea:focus{background:#fff!important;color:#171a20!important;border-color:#22b878!important;box-shadow:0 0 0 3px rgba(34,184,120,.11)!important}
html[data-theme="light"] body.v5-body option{background:#fff!important;color:#171a20!important}
html[data-theme="light"] body.v5-body input:disabled,
html[data-theme="light"] body.v5-body select:disabled,
html[data-theme="light"] body.v5-body textarea:disabled{background:#f0f3f6!important;color:#7b8591!important}
html[data-theme="light"] body.v5-body form{color:#171a20!important}
html[data-theme="light"] body.v5-body form label{color:#4f5965!important}

/* Search/filter/form shells */
html[data-theme="light"] body.v5-body :where(.filters,.service-pro-filter,.customer-searchbar,.device-pro-filter,.history-filter,.warranty-filter,.corp-search,.field-filter,.collection-filter,.unified-searchbar,.ops-board-toolbar,.quick-form,.form-grid,.field-form-grid,.promise-entry,.field-item-form,.field-payment-form){background:#fff!important;background-image:none!important;color:#171a20!important;border-color:#dfe4ea!important}

/* Modals / dialogs / bottom sheets */
html[data-theme="light"] body.v5-body :where(.modal,.modal-card,.comm-dialog,.mobile-create-sheet>section,.new-service-popup,.delivery-modal-form,.notify-modal,.detail-modal){background:#fff!important;background-image:none!important;color:#171a20!important;border-color:#dfe4ea!important}
html[data-theme="light"] body.v5-body :where(.modal-brandbar,.modal-head,.modal-actions,.comm-modal header,.mobile-create-sheet header){background:#fff!important;color:#171a20!important;border-color:#edf0f3!important}
html[data-theme="light"] body.v5-body :where(.modal::backdrop,.new-service-popup::backdrop,dialog::backdrop){background:rgba(15,23,42,.30)!important}

/* Main top bars */
html[data-theme="light"] body.v5-body :where(.topbar,.unified-page-head,.premium-head,.panel-head,.ops-card-head,.side-card-head){background:transparent!important;color:#171a20!important;border-color:#e3e7ec!important}
html[data-theme="light"] body.v5-body :where(.topbar h1,.unified-page-head h1,.premium-head h2,.panel-head h2,.ops-card-head h3){color:#171a20!important}
html[data-theme="light"] body.v5-body :where(.topbar p,.unified-page-head p,.premium-head p,.panel-head p){color:#66717e!important}

/* Neutral chips */
html[data-theme="light"] body.v5-body :where(.live-chip,.record-count,.service-closed-chip,.reminder-pill,.attention-note,.device-chip,.serial-chip){background:#f4f7f9!important;color:#4c5662!important;border-color:#dce2e8!important}
html[data-theme="light"] body.v5-body .phone-chip{background:#eaf9f1!important;color:#14744b!important;border-color:#ccefdc!important}

/* Keep semantic colored badges readable */
html[data-theme="light"] body.v5-body .badge.new{background:#eef1f4!important;color:#59636f!important}
html[data-theme="light"] body.v5-body .badge.diagnosis,html[data-theme="light"] body.v5-body .badge.repair{background:#eef4ff!important;color:#255ab3!important}
html[data-theme="light"] body.v5-body .badge.approval{background:#fff5df!important;color:#9a5c08!important}
html[data-theme="light"] body.v5-body .badge.waiting{background:#fff1e8!important;color:#a84c12!important}
html[data-theme="light"] body.v5-body .badge.ready{background:#eaf8f0!important;color:#147649!important}
html[data-theme="light"] body.v5-body .badge.delivered{background:#edf7f4!important;color:#326f61!important}
html[data-theme="light"] body.v5-body .badge.cancelled{background:#f7eeee!important;color:#8d5055!important}
html[data-theme="light"] body.v5-body [class*="status-"]{border-color:rgba(0,0,0,.08)!important}

/* Buttons: neutral + primary maintain contrast */
html[data-theme="light"] body.v5-body :where(.btn-light,.open-btn,.quick-action,.ops-board-filterchips a,.record-count,.quick-deliver-link){background:#f7f9fb!important;color:#20242a!important;border-color:#dfe4ea!important}
html[data-theme="light"] body.v5-body :where(.btn-dark,.btn-filter){background:#171a20!important;color:#fff!important;border-color:#171a20!important}
html[data-theme="light"] body.v5-body :where(.btn-primary,.v5-primary,.primary-quick,.mobile-new-service,.item-save){background:linear-gradient(135deg,#28d98a,#1ebf76)!important;color:#07120d!important;border-color:#20c87d!important}
html[data-theme="light"] body.v5-body :where(.btn-danger,.item-delete){background:#fff1f2!important;color:#b4232d!important;border-color:#f2c6cb!important}
html[data-theme="light"] body.v5-body button{color:inherit}

/* Sidebar: fully light, while preserving active green */
html[data-theme="light"] body.v5-body .v5-sidebar{background:#f8fafc!important;background-image:none!important;color:#171a20!important;border-right-color:#dfe4ea!important}
html[data-theme="light"] body.v5-body .v5-sidebar .brand{background:transparent!important;border:0!important;box-shadow:none!important}
html[data-theme="light"] body.v5-body .v5-nav-group{background:#fff!important;border-color:#e1e6eb!important;box-shadow:none!important}
html[data-theme="light"] body.v5-body .v5-nav-label{color:#79838f!important}
html[data-theme="light"] body.v5-body .v5-nav a{background:transparent!important;color:#4a5561!important;border-color:transparent!important}
html[data-theme="light"] body.v5-body .v5-nav a b{color:#313944!important}
html[data-theme="light"] body.v5-body .v5-nav-icon{background:#f2f5f7!important;color:#303842!important;border-color:#dce2e8!important}
html[data-theme="light"] body.v5-body .v5-nav a:hover{background:#f3f7f9!important;color:#171a20!important;border-color:#e0e5ea!important}
html[data-theme="light"] body.v5-body .v5-nav a.active{background:linear-gradient(135deg,rgba(34,184,120,.14),rgba(34,184,120,.06))!important;color:#102018!important;border-color:rgba(34,184,120,.23)!important;box-shadow:inset 3px 0 0 #22b878!important}
html[data-theme="light"] body.v5-body .v5-nav a.active b{color:#102018!important}
html[data-theme="light"] body.v5-body .v5-nav a.active .v5-nav-icon{background:#e8f8f0!important;color:#15734b!important;border-color:#c8ebd9!important}
html[data-theme="light"] body.v5-body .v5-nav-arrow{color:#8b95a0!important}
html[data-theme="light"] body.v5-body .v5-user-mini{background:#fff!important;color:#171a20!important;border-color:#e1e6eb!important}
html[data-theme="light"] body.v5-body .v5-user-copy span{color:#171a20!important}
html[data-theme="light"] body.v5-body .v5-user-copy small{color:#7b8590!important}
html[data-theme="light"] body.v5-body .v5-user-mini>a{background:#f3f6f8!important;color:#303842!important;border-color:#dde3e8!important}
html[data-theme="light"] body.v5-body .v5-theme-toggle{background:#f4f7f9!important;color:#2a3139!important;border-color:#d9e0e6!important}

/* Mobile app chrome */
@media(max-width:760px){
 html[data-theme="light"] body.v5-body .mobile-headbar{background:rgba(255,255,255,.98)!important;color:#171a20!important;border-bottom-color:#dfe4ea!important;box-shadow:0 2px 12px rgba(15,23,42,.05)!important}
 html[data-theme="light"] body.v5-body .mobile-headbar :where(button,a){background:#f5f7f9!important;color:#20262d!important;border-color:#dfe4ea!important}
 html[data-theme="light"] body.v5-body .mobile-headbar .mobile-home-link{background:transparent!important;border:0!important;color:#171a20!important}
 html[data-theme="light"] body.v5-body .mobile-page-title,html[data-theme="light"] body.v5-body .mobile-page-title b{color:#171a20!important}
 html[data-theme="light"] body.v5-body .mobile-page-title small{color:#7d8792!important}
 html[data-theme="light"] body.v5-body .mobile-bottom-nav{background:rgba(255,255,255,.99)!important;color:#6f7a86!important;border-top-color:#dfe4ea!important;box-shadow:0 -8px 24px rgba(15,23,42,.08)!important}
 html[data-theme="light"] body.v5-body .mobile-bottom-nav :where(a,button){color:#6f7a86!important}
 html[data-theme="light"] body.v5-body .mobile-bottom-nav .active{color:#171a20!important}
 html[data-theme="light"] body.v5-body .mobile-bottom-nav .mobile-new-service{background:linear-gradient(135deg,#28d98a,#1ebf76)!important;color:#07120d!important}
 html[data-theme="light"] body.v5-body .mobile-create-sheet>section{background:#fff!important;color:#171a20!important}
}

/* Service detail mobile dock */
html[data-theme="light"] body.v5-body .service-mobile-dock,
html[data-theme="light"] body.v5-body .field-mobile-sticky-actions{background:rgba(255,255,255,.98)!important;border-color:#dfe4ea!important;box-shadow:0 -8px 24px rgba(15,23,42,.08)!important}
html[data-theme="light"] body.v5-body .service-mobile-dock :where(a,button),
html[data-theme="light"] body.v5-body .field-mobile-sticky-actions :where(a,button){background:#f5f7f9!important;color:#27303a!important;border-color:#dfe4ea!important}
html[data-theme="light"] body.v5-body .service-mobile-dock :where(.primary,.ready,.next),
html[data-theme="light"] body.v5-body .field-mobile-sticky-actions button:last-child{background:#17a965!important;color:#fff!important;border-color:#17a965!important}

/* Login/public pages */
html[data-theme="light"] body.login-pro{background:radial-gradient(circle at 50% -10%,#fff 0%,#f1f4f7 52%,#e9edf1 100%)!important;color:#171a20!important}
html[data-theme="light"] body.login-pro .login-card{background:#fff!important;color:#171a20!important;border-color:#dfe4ea!important;box-shadow:0 24px 60px rgba(15,23,42,.12)!important}
html[data-theme="light"] body.login-pro .login-card :where(h1,label,span){color:#171a20!important}
html[data-theme="light"] body.login-pro .login-card>span{color:#d71920!important}
html[data-theme="light"] body.login-pro .login-card input{background:#fff!important;color:#171a20!important;border-color:#d7dde4!important}
html[data-theme="light"] body.login-pro .login-card button{background:#171a20!important;color:#fff!important}
html[data-theme="light"] body.login-pro .theme-toggle{background:#fff!important;color:#20262d!important;border-color:#d9dfe5!important}
html[data-theme="light"] body.lookup-page,
html[data-theme="light"] body.field-public-page{background:#f3f5f7!important;color:#171a20!important}
html[data-theme="light"] body.lookup-page :where(.lookup-card,.lookup-result,.card),
html[data-theme="light"] body.field-public-page :where(.public-card,.card,.box){background:#fff!important;color:#171a20!important;border-color:#dfe4ea!important}
html[data-theme="light"] body.lookup-page :where(h1,h2,h3,p,span,b,strong,label),
html[data-theme="light"] body.field-public-page :where(h1,h2,h3,p,span,b,strong,label){color:#171a20!important}
html[data-theme="light"] body.lookup-page :where(small,.muted),
html[data-theme="light"] body.field-public-page :where(small,.muted){color:#68717d!important}

/* Prevent legacy white-on-white leftovers in light main content, but do not flatten buttons/status chips */
html[data-theme="light"] body.v5-body .v5-main :where(
.service-item-row,.service-item-add,.service-item-list,.service-item-head,
.ops-summary-card,.ops-contact-row,.ops-flow,.ops-flow-track,.ops-flow-step,
.field-flow,.field-flow-step,.field-status-card,.field-status-line,
.account-summary,.account-kpi,.account-hero,.company-hero,.customer-hero,.device-hero,
.reminder-item,.reminder-row,.communication-item,.maintenance-item,.collection-item,
.payment-row,.payment-card,.promise-card,.timeline-item,.timeline-card,.timeline-log,
.detail-header,.detail-body,.detail-footer,.service-detail-shell,.service-workspace
){background:#fff!important;background-image:none!important;color:#171a20!important;border-color:#dfe4ea!important}

/* Intentional dark/colored controls restore */
html[data-theme="light"] body.v5-body :where(.btn-dark,.btn-filter,.metric-primary,.price-focus,.notify-hero,.attention-panel,.quick-status-bar,.ops-next-card,.v4-live-summary,.v4-summary-footer){color:#fff!important}
html[data-theme="light"] body.v5-body :where(.btn-dark,.btn-filter) *{color:#fff!important}

/* Print remains white */
@media print{html[data-theme="light"] body,html[data-theme="light"] body *{color:#111!important}html[data-theme="light"] body{background:#fff!important}.theme-toggle,.v5-theme-toggle{display:none!important}}
