/* =============================================================================
   HIRENTRA v0.9.0 BUILD 19 — WEB LIGHT THEME FIX1
   Loaded AFTER every feature stylesheet.

   Purpose:
   - Keep dark mode unchanged.
   - Make the resolved LIGHT appearance apply to the portal shell and every
     feature surface, including stylesheets loaded after styles.css.
   - Bridge feature-era variable names (--panel / --border) to the current
     shared theme tokens.
   ============================================================================= */

html[data-theme="light"] {
  color-scheme: light;
  --navy: #f4f7fb;
  --navy-light: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: rgba(15, 23, 42, .11);
  --muted: #64748b;
  --text: #0f172a;
  --line: rgba(15, 23, 42, .10);
  --line-strong: rgba(15, 23, 42, .18);
  --shadow: 0 20px 60px rgba(15, 23, 42, .10);
  background: #f4f7fb;
}

html[data-theme="light"] body,
html[data-theme="light"] body.portal-mode {
  color: #0f172a;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 193, 7, .08), transparent 26rem),
    radial-gradient(circle at 10% 84%, rgba(59, 130, 246, .05), transparent 28rem),
    #f4f7fb;
}

/* -------------------------------------------------------------------------- */
/* Portal shell / navigation / page canvas                                    */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .dashboard-shell {
  background: rgba(255, 255, 255, .88) !important;
  border-color: rgba(15, 23, 42, .10) !important;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .sidebar {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .dashboard-main {
  color: #0f172a !important;
  background:
    radial-gradient(circle at 88% 3%, rgba(255, 193, 7, .065), transparent 28rem),
    #f4f7fb !important;
}

html[data-theme="light"] .portal-page,
html[data-theme="light"] .dashboard-content,
html[data-theme="light"] .dashboard-header,
html[data-theme="light"] .company-copy strong,
html[data-theme="light"] .sidebar-footer strong {
  color: #0f172a;
}

html[data-theme="light"] .dashboard-header h1,
html[data-theme="light"] .portal-page h1,
html[data-theme="light"] .portal-page h2,
html[data-theme="light"] .portal-page h3,
html[data-theme="light"] .portal-page h4,
html[data-theme="light"] .portal-page strong,
html[data-theme="light"] .portal-page b {
  color: inherit;
}

html[data-theme="light"] .dashboard-kicker,
html[data-theme="light"] .section-kicker,
html[data-theme="light"] .sidebar-footer span {
  color: #b77900;
}

html[data-theme="light"] .dashboard-subtitle,
html[data-theme="light"] .last-updated span,
html[data-theme="light"] .last-updated strong,
html[data-theme="light"] .company-copy span,
html[data-theme="light"] .portal-page small,
html[data-theme="light"] .portal-page p,
html[data-theme="light"] .portal-page label > span {
  color: #64748b;
}

html[data-theme="light"] .nav-item {
  color: #475569 !important;
}

html[data-theme="light"] .nav-item:hover {
  color: #0f172a !important;
  background: rgba(15, 23, 42, .045) !important;
  border-color: rgba(15, 23, 42, .07) !important;
}

html[data-theme="light"] .nav-item.active {
  color: #0f172a !important;
  background: rgba(255, 193, 7, .11) !important;
  border-color: rgba(180, 126, 0, .20) !important;
}

/* -------------------------------------------------------------------------- */
/* Shared controls                                                            */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .management-scope select,
html[data-theme="light"] .management-select,
html[data-theme="light"] .inline-create-form input,
html[data-theme="light"] .site-create-form input,
html[data-theme="light"] .management-search,
html[data-theme="light"] .role-editor-row select,
html[data-theme="light"] #signupCard select,
html[data-theme="light"] .asset-edit-field input,
html[data-theme="light"] .asset-edit-field select,
html[data-theme="light"] .asset-edit-field textarea,
html[data-theme="light"] .invoice-document-upload-controls select,
html[data-theme="light"] .web061-admin-grid input,
html[data-theme="light"] .web061-admin-grid select,
html[data-theme="light"] .web061-admin-notes input,
html[data-theme="light"] .web061-section-title select,
html[data-theme="light"] .web062-price-setting input,
html[data-theme="light"] .web062-price-setting select,
html[data-theme="light"] .web062-grace-setting input {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .15) !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #94a3b8 !important;
}

html[data-theme="light"] .secondary-button,
html[data-theme="light"] .refresh-button,
html[data-theme="light"] .report-clear-button,
html[data-theme="light"] .top-sign-out,
html[data-theme="light"] .compact-button {
  color: #334155 !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .12) !important;
}

html[data-theme="light"] .secondary-button:hover,
html[data-theme="light"] .refresh-button:hover,
html[data-theme="light"] .report-clear-button:hover,
html[data-theme="light"] .compact-button:hover {
  color: #0f172a !important;
  background: #f8fafc !important;
  border-color: rgba(180, 126, 0, .30) !important;
}

/* -------------------------------------------------------------------------- */
/* Core portal surfaces                                                       */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .card,
html[data-theme="light"] .profile-summary > div,
html[data-theme="light"] .mini-stat,
html[data-theme="light"] .panel-section,
html[data-theme="light"] .exposure-list,
html[data-theme="light"] .data-row,
html[data-theme="light"] .site-card,
html[data-theme="light"] .asset-table,
html[data-theme="light"] .modal,
html[data-theme="light"] .detail-cell,
html[data-theme="light"] .page-toolbar,
html[data-theme="light"] .summary-chip,
html[data-theme="light"] .asset-mobile-card,
html[data-theme="light"] .site-project-card,
html[data-theme="light"] .site-project-stat,
html[data-theme="light"] .evidence-card,
html[data-theme="light"] .movement-card,
html[data-theme="light"] .evidence-note,
html[data-theme="light"] .report-mobile-card,
html[data-theme="light"] .management-tabs,
html[data-theme="light"] .management-panel,
html[data-theme="light"] .company-settings-card,
html[data-theme="light"] .company-mini-stat,
html[data-theme="light"] .managed-site-card,
html[data-theme="light"] .management-summary-card,
html[data-theme="light"] .managed-user-card,
html[data-theme="light"] .site-assignment-check label,
html[data-theme="light"] .pending-request-meta,
html[data-theme="light"] .asset-edit-form,
html[data-theme="light"] .edit-audit-card,
html[data-theme="light"] .audit-mobile-card,
html[data-theme="light"] .offhire-plan-card,
html[data-theme="light"] .analytics-mobile-card,
html[data-theme="light"] .supplier-directory-card,
html[data-theme="light"] .supplier-performance-mobile-card,
html[data-theme="light"] .offhire-activity-card,
html[data-theme="light"] .invoice-mobile-card,
html[data-theme="light"] .invoice-detail-summary > div,
html[data-theme="light"] .invoice-documents-panel,
html[data-theme="light"] .invoice-finance-panel,
html[data-theme="light"] .invoice-finance-summary > div,
html[data-theme="light"] .invoice-finance-details > div,
html[data-theme="light"] .invoice-asset-lookup,
html[data-theme="light"] .invoice-asset-lookup-grid > div,
html[data-theme="light"] .returned-asset-invoice-summary > div,
html[data-theme="light"] .step4l-commercial-panel,
html[data-theme="light"] .inventory-form-intro,
html[data-theme="light"] .inventory-history-card,
html[data-theme="light"] .step5b-mobile-card,
html[data-theme="light"] .step5b-incident-card,
html[data-theme="light"] .step5b-incident-copy,
html[data-theme="light"] .step5b-resolution-panel,
html[data-theme="light"] .step5b-history-incident,
html[data-theme="light"] .step5b-detail-list button,
html[data-theme="light"] .step5b-supplier-summary > div,
html[data-theme="light"] .step5b-report-incident-grid > div,
html[data-theme="light"] .step5b-supplier-directory-box > div,
html[data-theme="light"] .step5b-supplier-intel-card,
html[data-theme="light"] .commercial-v2-documents {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .summary-chip,
html[data-theme="light"] .site-project-stat,
html[data-theme="light"] .evidence-note,
html[data-theme="light"] .pending-request-meta,
html[data-theme="light"] .invoice-finance-summary > div,
html[data-theme="light"] .invoice-finance-details > div,
html[data-theme="light"] .invoice-asset-lookup-grid > div,
html[data-theme="light"] .returned-asset-invoice-summary > div,
html[data-theme="light"] .step5b-incident-copy,
html[data-theme="light"] .step5b-resolution-panel,
html[data-theme="light"] .step5b-history-incident,
html[data-theme="light"] .step5b-supplier-summary > div,
html[data-theme="light"] .step5b-report-incident-grid > div,
html[data-theme="light"] .step5b-supplier-directory-box > div {
  background: #f8fafc !important;
}

/* Keep feature heroes visually distinct but light. */
html[data-theme="light"] .reports-hero,
html[data-theme="light"] .management-hero,
html[data-theme="light"] .audit-hero,
html[data-theme="light"] .analytics-hero,
html[data-theme="light"] .supplier-hero {
  color: #0f172a !important;
  background:
    linear-gradient(125deg, rgba(255, 193, 7, .09), transparent 52%),
    #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

/* Tables: dark header bands were left behind by the old dark-only theme. */
html[data-theme="light"] .asset-register-table thead,
html[data-theme="light"] .report-table thead,
html[data-theme="light"] .audit-table thead,
html[data-theme="light"] .po-live-assets-table th {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .asset-table td,
html[data-theme="light"] .asset-register-table td,
html[data-theme="light"] .report-table td,
html[data-theme="light"] .audit-table td,
html[data-theme="light"] .po-live-assets-table td,
html[data-theme="light"] .modal-table td {
  color: #334155 !important;
  border-color: rgba(15, 23, 42, .08) !important;
}

html[data-theme="light"] .table-wrap,
html[data-theme="light"] .po-live-assets-table-wrap {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

/* -------------------------------------------------------------------------- */
/* Build 15 compliance                                                       */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web5c-metric,
html[data-theme="light"] .web5c-attention-row,
html[data-theme="light"] .web5c-detail-header,
html[data-theme="light"] .web5c-requirement,
html[data-theme="light"] .web5c-hold,
html[data-theme="light"] .web5c-evidence,
html[data-theme="light"] .web5c-manage-toolbar,
html[data-theme="light"] .web5c-asset-manage-bar,
html[data-theme="light"] .web5c-profile-card,
html[data-theme="light"] .web5c-requirement-manage-card {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .web5c-metric,
html[data-theme="light"] .web5c-detail-header,
html[data-theme="light"] .web5c-manage-toolbar,
html[data-theme="light"] .web5c-asset-manage-bar {
  background: #f8fafc !important;
}

/* -------------------------------------------------------------------------- */
/* Build 16 supplier billing                                                  */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web162-rule-intro,
html[data-theme="light"] .web162-rule-card {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .web162-rule-intro {
  background: #f8fafc !important;
}

/* -------------------------------------------------------------------------- */
/* Build 18 off-hire / collection logistics                                   */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web18-area-form,
html[data-theme="light"] .web18-area-card,
html[data-theme="light"] .web18-booking-preview-panel,
html[data-theme="light"] .web18-message-view pre {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .web18-area-form,
html[data-theme="light"] .web18-booking-preview-panel,
html[data-theme="light"] .web18-message-view pre {
  background: #f8fafc !important;
}

/* -------------------------------------------------------------------------- */
/* Build 19 Phase 2.1 recycle bin                                             */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web19p21-filter-grid select,
html[data-theme="light"] .web19p21-filter-grid input,
html[data-theme="light"] .web19p21-delete-panel select,
html[data-theme="light"] .web19p21-delete-panel textarea {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

/* -------------------------------------------------------------------------- */
/* Build 19 Phase 2.2 Starter-safe hire cost overview                         */
/* This is the screen that exposed the bug: cards were themed, page canvas was
   still dark because its feature CSS loads after the original shared theme. */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web19p22-hire-cost-view {
  color: #0f172a !important;
}

html[data-theme="light"] .web19p22-hero,
html[data-theme="light"] .web19p22-stats > div,
html[data-theme="light"] .web19p22-row {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .11) !important;
}

html[data-theme="light"] .web19p22-hero span,
html[data-theme="light"] .web19p22-stats span,
html[data-theme="light"] .web19p22-row span {
  color: #64748b !important;
  opacity: 1 !important;
}

/* -------------------------------------------------------------------------- */
/* Build 19 Phase 2.3 data exchange                                           */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web19p23-exposure-grid > div,
html[data-theme="light"] .web19p23-stat,
html[data-theme="light"] .web19p23-card,
html[data-theme="light"] .web19p23-history article,
html[data-theme="light"] .web19p23-import-note,
html[data-theme="light"] .web19p23-error-row {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .web19p23-exposure-grid > div,
html[data-theme="light"] .web19p23-stat,
html[data-theme="light"] .web19p23-history article,
html[data-theme="light"] .web19p23-import-note,
html[data-theme="light"] .web19p23-error-row {
  background: #f8fafc !important;
}

html[data-theme="light"] .web19p23-hero {
  color: #0f172a !important;
  background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

/* -------------------------------------------------------------------------- */
/* Build 19 Phase 2.4 Enterprise Integration                                  */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web19p24a-metrics article,
html[data-theme="light"] .web19p24a-card,
html[data-theme="light"] .web19p24a-map-row,
html[data-theme="light"] .web19p24a-job,
html[data-theme="light"] .web19p24a-dialog {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .web19p24a-map-row,
html[data-theme="light"] .web19p24a-job {
  background: #f8fafc !important;
}

/* -------------------------------------------------------------------------- */
/* Build 19 Phase 2.5A pilot readiness                                        */
/* Existing feature light rules remain authoritative; these guarantee the page
   canvas/controls inherit the late-loaded theme tokens. */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web19p2-view,
html[data-theme="light"] .web19p2-content {
  color: #0f172a !important;
}

/* -------------------------------------------------------------------------- */
/* Admin / subscription surfaces                                              */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .web062-admin-hero {
  color: #0f172a !important;
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, .10), transparent 45%),
    #ffffff !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

/* -------------------------------------------------------------------------- */
/* Modal overlay                                                              */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, .42) !important;
}

/* Semantic colours: improve contrast in light mode without changing meaning. */
html[data-theme="light"] .connection-state,
html[data-theme="light"] .hirentra-status-pill.good,
html[data-theme="light"] .final-invoice-state.confirmed strong {
  color: #15803d !important;
}

html[data-theme="light"] .hirentra-status-pill.warn,
html[data-theme="light"] .final-invoice-state strong {
  color: #92400e !important;
}

html[data-theme="light"] .hirentra-status-pill.bad,
html[data-theme="light"] .hirentra-status-pill.cancelled {
  color: #b91c1c !important;
}

html[data-theme="light"] .hirentra-status-pill.open { color: #1d4ed8 !important; }
html[data-theme="light"] .hirentra-status-pill.ready,
html[data-theme="light"] .po-ready-message { color: #0e7490 !important; }
