/* Employee ERP v14.9.2 — Safe UI Stabilization
   Non-destructive overlay: fixes theme contrast and map fidelity while preserving v14.8 logic/layout. */
:root{
  --erp-card:var(--surface,#fff);--erp-card-2:var(--surface-2,#f8fafc);--erp-card-3:var(--surface-3,#eef4fb);
  --erp-text:var(--text,#0f172a);--erp-muted:var(--muted,#64748b);--erp-line:var(--line,#dbe3ef);
}
html[data-theme="dark"] body{color:var(--erp-text)}
html[data-theme="dark"] .content{color:var(--erp-text)}

/* Core surfaces: remove hard-coded white cards that broke Dark mode in the recorded video. */
html[data-theme="dark"] .panel,
html[data-theme="dark"] .notification-card,
html[data-theme="dark"] .company-request-card,
html[data-theme="dark"] .workflow-card,
html[data-theme="dark"] .employee-profile-card,
html[data-theme="dark"] .employee-record-card,
html[data-theme="dark"] .company-directory-card,
html[data-theme="dark"] .company-directory-card-modern,
html[data-theme="dark"] .wf-template-card,
html[data-theme="dark"] .report-modern-grid a,
html[data-theme="dark"] .report-filter-panel,
html[data-theme="dark"] .report-toolbar{
  background:linear-gradient(145deg,var(--erp-card),var(--erp-card-2))!important;
  color:var(--erp-text)!important;border-color:var(--erp-line)!important;
}
html[data-theme="dark"] .notification-card h3,
html[data-theme="dark"] .notification-card b,
html[data-theme="dark"] .company-request-card h3,
html[data-theme="dark"] .company-request-card b,
html[data-theme="dark"] .employee-profile-card h3,
html[data-theme="dark"] .workflow-card h3{color:var(--erp-text)!important}
html[data-theme="dark"] .notification-card p,
html[data-theme="dark"] .notification-card small,
html[data-theme="dark"] .request-card-head p,
html[data-theme="dark"] .request-facts small,
html[data-theme="dark"] .company-card-subline{color:var(--erp-muted)!important}
html[data-theme="dark"] .request-card-head,
html[data-theme="dark"] .request-facts>div,
html[data-theme="dark"] .workflow-step,
html[data-theme="dark"] .employee-facts{border-color:var(--erp-line)!important}
html[data-theme="dark"] .request-actions,
html[data-theme="dark"] .company-card-actions,
html[data-theme="dark"] .brand-upload{background:var(--erp-card-2)!important;border-color:var(--erp-line)!important}
html[data-theme="dark"] .request-logo-placeholder{background:var(--erp-card-3)!important;color:var(--erp-text)!important}
html[data-theme="dark"] .request-review-form textarea{background:var(--erp-card)!important;color:var(--erp-text)!important;border-color:var(--erp-line)!important}

/* Inputs, tables, menus and secondary actions retain readable contrast in both modes. */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .smart-select-input,
html[data-theme="dark"] .catalog-combo-menu,
html[data-theme="dark"] .language-dropdown-menu,
html[data-theme="dark"] .user-dropdown-menu{
  background:var(--erp-card)!important;color:var(--erp-text)!important;border-color:var(--erp-line)!important;
}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:var(--erp-muted)!important;opacity:.82}
html[data-theme="dark"] th{background:var(--erp-card-2)!important;color:var(--erp-muted)!important;border-color:var(--erp-line)!important}
html[data-theme="dark"] td{color:var(--erp-text)!important;border-color:var(--erp-line)!important}
html[data-theme="dark"] .btn.secondary{background:var(--erp-card-2)!important;color:var(--erp-text)!important;border-color:var(--erp-line)!important}
html[data-theme="dark"] .badge{border:1px solid color-mix(in srgb,var(--accent) 28%,var(--erp-line));}

/* Dashboard proportions: compact like the supplied reference, without hiding legacy sections. */
.reference-dashboard{gap:12px!important;margin-top:6px!important}
.reference-kpis{gap:12px!important}
.ref-kpi{min-height:88px!important;padding:12px 13px!important;border-radius:14px!important}
.ref-kpi strong{font-size:23px!important}.ref-kpi>span{width:43px!important;height:43px!important}
.reference-main-grid{grid-template-columns:minmax(0,2.65fr) minmax(285px,.78fr)!important;gap:12px!important}
.ref-card{border-radius:14px!important}.ref-donut{width:min(170px,80%)!important}

/* Map: exact 1000x470 coordinate plane, no stretching/grey filter, local fallback always available. */
.approved-world-map{
  position:relative!important;min-height:0!important;aspect-ratio:1000/470!important;width:100%!important;
  background:#061321!important;isolation:isolate;box-shadow:inset 0 0 60px rgba(29,126,255,.09),0 12px 32px rgba(3,18,35,.10)!important;
}
.approved-world-map .approved-map-fallback,
.approved-world-map .approved-map-image{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;object-fit:contain!important;object-position:center!important}
.approved-world-map .approved-map-fallback{z-index:0;display:block;opacity:.82}
.approved-world-map .approved-map-image{z-index:1;filter:none!important;opacity:1!important;transform-origin:center center!important}
html[data-theme="light"] .approved-world-map{background:#f5f9fe!important;border-color:#d5e5f4!important}
html[data-theme="light"] .approved-world-map .approved-map-fallback{opacity:.12;filter:grayscale(1) brightness(1.8)}
html[data-theme="light"] .approved-world-map .map-light{filter:none!important;opacity:1!important}
html[data-theme="dark"] .approved-world-map .map-dark{filter:none!important;opacity:1!important}
.approved-world-map .geo-map-pins{z-index:4!important;overflow:visible!important;transform-origin:center center!important}
.approved-world-map .geo-route{stroke-width:1.55!important;opacity:.62!important;filter:drop-shadow(0 0 2px currentColor)}
html[data-theme="light"] .approved-world-map .geo-route{opacity:.43!important}
.approved-world-map .geo-pin-halo{fill:rgba(39,150,255,.12)!important;stroke:rgba(73,173,255,.52)!important}
.approved-world-map .geo-pin-ring{stroke:rgba(255,255,255,.78)!important;stroke-width:1.35!important}
html[data-theme="light"] .approved-world-map .geo-pin-ring{stroke:rgba(34,78,126,.35)!important}
.approved-world-map .geo-pin-dot{filter:drop-shadow(0 0 8px rgba(22,132,255,.95))!important}
.approved-world-map .geo-pin-svg text{font-size:10.5px!important;stroke:rgba(0,0,0,.42)!important;stroke-width:.8!important}
.approved-map-filter{align-self:stretch!important}
.geo-map-toolbar button{backdrop-filter:blur(10px)}
.geo-map-tooltip{max-width:190px}

/* RTL/LTR safety and long text truncation. */
.employee-card-body,.request-card-head>div:nth-child(2),.user-chip>div{min-width:0}
.employee-card-title h3,.request-card-head h3,.company-card-subline span{overflow:hidden;text-overflow:ellipsis}
html[dir="rtl"] .employee-profile-card,html[dir="rtl"] .company-request-card{text-align:right}
html[dir="ltr"] .employee-profile-card,html[dir="ltr"] .company-request-card{text-align:left}

/* Responsive: keep the map visible and the dashboard usable on mobile. */
@media(max-width:1050px){.reference-main-grid{grid-template-columns:1fr!important}.reference-side{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){.reference-side{grid-template-columns:1fr!important}.approved-map-layout{grid-template-columns:1fr!important}.approved-world-map{aspect-ratio:1000/560!important}.approved-map-filter{grid-template-columns:1fr 1fr!important}}
@media(max-width:500px){.approved-world-map{aspect-ratio:1000/650!important}.reference-kpis{gap:8px!important}.ref-kpi strong{font-size:20px!important}}
