/* ========================================================================
   SIGMANEX CMMS  |  v1.2.7  |  Sky Blue + Blue + Yellow
   Update-only visual theme. Scoped to the existing authenticated app body.
   The existing photographic 1:1 login page remains unchanged.
   ======================================================================== */

body.sigmanex-modern-ui {
  /* Design tokens are HSL because the existing Tailwind UI consumes hsl(var()) */
  --background: 201 100% 98%;
  --foreground: 212 55% 17%;
  --card: 0 0% 100%;
  --card-foreground: 212 55% 17%;
  --popover: 0 0% 100%;
  --popover-foreground: 212 55% 17%;
  --primary: 211 83% 43%;
  --primary-foreground: 0 0% 100%;
  --secondary: 200 93% 94%;
  --secondary-foreground: 210 72% 26%;
  --muted: 202 68% 96%;
  --muted-foreground: 211 20% 46%;
  --accent: 199 96% 92%;
  --accent-foreground: 211 81% 30%;
  --border: 201 62% 89%;
  --input: 202 57% 86%;
  --ring: 197 90% 48%;
  --sidebar-background: 207 86% 31%;
  --sidebar-foreground: 200 100% 94%;
  --sidebar-primary: 47 100% 63%;
  --sidebar-primary-foreground: 213 72% 21%;
  --sidebar-accent: 202 87% 44%;
  --sidebar-accent-foreground: 0 0% 100%;
  --sidebar-border: 202 54% 48%;
  --sx-sky: #42c4f6;
  --sx-sky-strong: #0fa9eb;
  --sx-blue: #146fc8;
  --sx-blue-deep: #0a579d;
  --sx-yellow: #ffd34d;
  --sx-yellow-soft: #fff6d8;
  --sx-ink: #153453;
  --sx-line: #d7eaf7;
  --sx-paper: #f3fbff;
  background: var(--sx-paper) !important;
  color: var(--sx-ink);
  color-scheme: light;
}
body.sigmanex-modern-ui ::selection { background: #bfeaff; color: #0b456e; }

/* New, airy canvas with two soft light blooms, instead of the navy/slate wash. */
body.sigmanex-modern-ui #root > div.min-h-screen {
  background:
    radial-gradient(ellipse at 83% -8%, rgba(64, 192, 250, .19), transparent 43%),
    radial-gradient(ellipse at 13% 88%, rgba(255, 211, 77, .095), transparent 43%),
    linear-gradient(125deg, #f5fcff 0%, #f1f9ff 52%, #eef8ff 100%) !important;
}

/* ── Sidebar: bright deep-blue gradient, warm yellow active marker ─────── */
body.sigmanex-modern-ui aside {
  background:
    radial-gradient(circle at 7% 0%, rgba(146, 226, 255, .27), transparent 31%),
    radial-gradient(circle at 101% 74%, rgba(56, 189, 248, .18), transparent 44%),
    linear-gradient(171deg, #08609d 0%, #1178be 43%, #09518d 100%) !important;
  border-right: 1px solid rgba(203, 240, 255, .32) !important;
  box-shadow: 14px 0 35px rgba(8, 86, 158, .10) !important;
}
body.sigmanex-modern-ui aside > div:first-child {
  border-bottom: 1px solid rgba(219, 245, 255, .17) !important;
  background: rgba(255,255,255,.055) !important;
}
body.sigmanex-modern-ui aside h1 { color: #fff !important; letter-spacing: .055em !important; }
body.sigmanex-modern-ui aside h1 + p,
body.sigmanex-modern-ui aside > div:last-child p { color: #c0eafb !important; }
body.sigmanex-modern-ui .sx-modern-brand-icon {
  border: 1px solid rgba(255, 240, 178, .80) !important;
  border-radius: 13px !important;
  background: linear-gradient(145deg, #fffdf0, #e5f8ff) !important;
  box-shadow: 0 7px 20px rgba(6, 55, 105, .20), 0 0 0 4px rgba(255, 211, 77, .10) !important;
}
body.sigmanex-modern-ui .sx-modern-brand-icon img { filter: none !important; }
body.sigmanex-modern-ui aside nav > a,
body.sigmanex-modern-ui aside nav > div > a,
body.sigmanex-modern-ui .sxwf-nav-link {
  color: rgba(241, 250, 255, .91) !important;
  border: 1px solid transparent !important;
  font-weight: 640 !important;
}
body.sigmanex-modern-ui aside nav > a:hover,
body.sigmanex-modern-ui aside nav > div > a:hover,
body.sigmanex-modern-ui .sxwf-nav-link:hover {
  background: rgba(194, 238, 255, .17) !important;
  color: #fff !important;
  border-color: rgba(225,247,255,.16) !important;
}
body.sigmanex-modern-ui aside nav > a[class*="bg-[hsl(var(--sidebar-primary))]"],
body.sigmanex-modern-ui aside nav > div > a[class*="bg-[hsl(var(--sidebar-primary))]"],
body.sigmanex-modern-ui .sxwf-nav-link.active {
  background: linear-gradient(110deg, #ffe78a 0%, #ffcf42 100%) !important;
  color: #153657 !important;
  border-color: rgba(255,255,255,.58) !important;
  box-shadow: 0 8px 20px rgba(9, 67, 119, .18), inset 0 1px 0 rgba(255,255,255,.55) !important;
}
body.sigmanex-modern-ui aside nav > a[class*="bg-[hsl(var(--sidebar-primary))]"] svg,
body.sigmanex-modern-ui aside nav > div > a[class*="bg-[hsl(var(--sidebar-primary))]"] svg,
body.sigmanex-modern-ui .sxwf-nav-link.active svg { color: #155281 !important; }
body.sigmanex-modern-ui aside nav svg { opacity: .97; }
body.sigmanex-modern-ui aside button:hover { background: rgba(255,255,255,.13) !important; }

/* ── Floating/frosted topbar ───────────────────────────────────────────── */
body.sigmanex-modern-ui header {
  background: linear-gradient(100deg, rgba(255,255,255,.96), rgba(241,250,255,.92)) !important;
  border-bottom: 1px solid #cfe8f7 !important;
  box-shadow: 0 7px 24px rgba(37,132,192,.055) !important;
  backdrop-filter: blur(18px) saturate(145%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(145%) !important;
}
body.sigmanex-modern-ui header h2 {
  color: #145489 !important;
  font-weight: 820 !important;
}
body.sigmanex-modern-ui header .sx-modern-top-kicker {
  background: #e9f8ff !important;
  color: #0d6eab !important;
  border: 1px solid #c4eafc !important;
}
body.sigmanex-modern-ui header button:hover { background: #def5ff !important; }
body.sigmanex-modern-ui header button > div[class*="rounded-full"] {
  background: linear-gradient(145deg, #dff5ff, #fff4cf) !important;
  border-color: #bbe8ff !important;
}

/* ── Typography, layout, content cards ────────────────────────────────── */
body.sigmanex-modern-ui main { color: #1b3856; }
body.sigmanex-modern-ui main h1 { color: #143b60 !important; }
body.sigmanex-modern-ui main h2,
body.sigmanex-modern-ui main h3 { color: #194565; }
body.sigmanex-modern-ui main p.text-muted-foreground { color: #758fa3 !important; }
body.sigmanex-modern-ui main .bg-card.rounded-xl.border,
body.sigmanex-modern-ui main .bg-card.rounded-lg.border,
body.sigmanex-modern-ui main section.bg-card,
body.sigmanex-modern-ui main div[class*="bg-card"][class*="shadow"] {
  border-color: #d6eaf8 !important;
  background: linear-gradient(148deg, #fff 0%, #fcfeff 100%) !important;
  border-radius: 19px !important;
  box-shadow: 0 10px 26px rgba(17, 105, 165, .055), inset 0 1px 0 #fff !important;
}
body.sigmanex-modern-ui main .bg-card.rounded-xl.border.shadow-sm:hover {
  border-color: #b3dff7 !important;
  box-shadow: 0 15px 35px rgba(10, 114, 188, .09) !important;
}
body.sigmanex-modern-ui main [class*="bg-muted"]:not(button):not([role="tablist"]) {
  border-color: #e1f1f9;
}

/* ── Brighter buttons, crisp inputs and focus states ───────────────────── */
body.sigmanex-modern-ui main button[class*="bg-primary"],
body.sigmanex-modern-ui [role="dialog"] button[class*="bg-primary"],
body.sigmanex-modern-ui main a[class*="bg-primary"] {
  background: linear-gradient(126deg, #168fdc 0%, #146ac6 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.26) !important;
  box-shadow: 0 8px 18px rgba(10, 114, 188, .17) !important;
}
body.sigmanex-modern-ui main button[class*="bg-primary"]:hover:not(:disabled),
body.sigmanex-modern-ui [role="dialog"] button[class*="bg-primary"]:hover:not(:disabled) {
  background: linear-gradient(126deg, #0eacf0, #1160b5) !important;
  box-shadow: 0 10px 24px rgba(10, 114, 188, .21) !important;
}
body.sigmanex-modern-ui main input:not([type="checkbox"]):not([type="radio"]),
body.sigmanex-modern-ui main select,
body.sigmanex-modern-ui main textarea,
body.sigmanex-modern-ui [role="dialog"] input:not([type="checkbox"]):not([type="radio"]),
body.sigmanex-modern-ui [role="dialog"] select,
body.sigmanex-modern-ui [role="dialog"] textarea {
  background: #fff !important;
  border: 1px solid #cfe5f4 !important;
  color: #203c58 !important;
  border-radius: 11px !important;
}
body.sigmanex-modern-ui main input:focus,
body.sigmanex-modern-ui main select:focus,
body.sigmanex-modern-ui main textarea:focus,
body.sigmanex-modern-ui [role="dialog"] input:focus,
body.sigmanex-modern-ui [role="dialog"] select:focus,
body.sigmanex-modern-ui [role="dialog"] textarea:focus {
  border-color: #49bdf4 !important;
  outline-color: #58c7fa !important;
  box-shadow: 0 0 0 3px rgba(44, 184, 244, .15) !important;
}
body.sigmanex-modern-ui main input[type="checkbox"],
body.sigmanex-modern-ui [role="dialog"] input[type="checkbox"] { accent-color: #1676c9; }
body.sigmanex-modern-ui :is(button,a,input,select,textarea):focus-visible {
  outline: 2px solid #39bdf6;
  outline-offset: 2px;
}

/* ── Work-order / master-data tables ───────────────────────────────────── */
body.sigmanex-modern-ui main table { border-color: #deedf7 !important; }
body.sigmanex-modern-ui main table thead tr {
  background: linear-gradient(90deg, #e9f7ff 0%, #f2fbff 100%) !important;
}
body.sigmanex-modern-ui main table th {
  background: transparent !important;
  border-bottom-color: #c8e7f9 !important;
  color: #245d87 !important;
  font-size: 11px !important;
  letter-spacing: .047em;
}
body.sigmanex-modern-ui main table tbody tr { border-bottom-color: #e6f1f8 !important; }
body.sigmanex-modern-ui main table tbody tr:hover { background: #edf9ff !important; }
body.sigmanex-modern-ui main table tbody td { border-bottom-color: #e9f3f9 !important; }
body.sigmanex-modern-ui main [role="tablist"] {
  background: #e6f4fd !important;
  border: 1px solid #d1eafb !important;
}
body.sigmanex-modern-ui main [role="tab"][data-state="active"] {
  background: #fff !important;
  color: #116caf !important;
  border-bottom: 2px solid #ffca37 !important;
}
body.sigmanex-modern-ui [role="dialog"],
body.sigmanex-modern-ui [role="alertdialog"] {
  border: 1px solid #cde6f7 !important;
  background: linear-gradient(155deg, #fff, #fbfeff) !important;
  border-radius: 20px !important;
  box-shadow: 0 26px 80px rgba(11, 85, 145, .18) !important;
}
body.sigmanex-modern-ui [role="menu"] {
  border-color: #cde4f4 !important;
  background: #fff !important;
}

/* ── Dashboard v1.2.4: performance indicators and action queues ────────── */
body.sigmanex-modern-ui .sxdash-head h1 {
  color: #124c7a !important;
  font-weight: 850;
}
body.sigmanex-modern-ui .sxdash-head p { color: #69879e; }
body.sigmanex-modern-ui .sxdash-kpi {
  background: linear-gradient(150deg, #fff 0%, #faffff 100%) !important;
  border: 1px solid #d3e8f7 !important;
  border-radius: 19px !important;
  box-shadow: 0 9px 24px rgba(8, 112, 177, .06) !important;
}
body.sigmanex-modern-ui .sxdash-kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 21px;
  right: 21px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, #52cbff, #1e86df);
}
body.sigmanex-modern-ui .sxdash-kpi:nth-child(3n+2)::before {
  background: linear-gradient(90deg, #ffdf7e, #ffc52d);
}
body.sigmanex-modern-ui .sxdash-kpi:nth-child(3n+3)::before {
  background: linear-gradient(90deg, #0c78d2, #4ecaff);
}
body.sigmanex-modern-ui .sxdash-kpi:hover {
  border-color: #a6dafa !important;
  box-shadow: 0 15px 34px rgba(14, 128, 198, .10) !important;
}
body.sigmanex-modern-ui .sxdash-kpi-label { color: #66869e; }
body.sigmanex-modern-ui .sxdash-kpi-value { color: #134c7a; }
body.sigmanex-modern-ui .sxdash-kpi-icon { box-shadow: inset 0 0 0 1px rgba(17, 132, 203, .045); }
body.sigmanex-modern-ui .sxdash-panel {
  border: 1px solid #d5e9f6 !important;
  background: #fff !important;
  border-radius: 19px !important;
  box-shadow: 0 9px 28px rgba(17, 105, 165, .055) !important;
}
body.sigmanex-modern-ui .sxdash-panel-head {
  background: linear-gradient(90deg, #fff, #f5fbff);
  border-bottom-color: #e0f0fa !important;
}
body.sigmanex-modern-ui .sxdash-panel-head h3 { color: #175280; }
body.sigmanex-modern-ui .sxdash-row:hover { background: #eff9ff !important; }
body.sigmanex-modern-ui .sxdash-dot {
  color: #0c72bb;
  background: #e6f7ff;
  border: 1px solid #d2ebfa;
}
body.sigmanex-modern-ui .sxdash-link { color: #0b73bb; }
body.sigmanex-modern-ui .sxdash-refresh {
  border-color: #cae6f7;
  background: #fff;
  color: #125e9e;
}
body.sigmanex-modern-ui .sxdash-refresh:hover {
  background: #ecfaff;
  border-color: #83d4ff;
}
body.sigmanex-modern-ui .sxdash-alert {
  border-color: #f3d68c;
  background: #fff9e9;
}

/* ── Preventive / Corrective panels and WO cards ───────────────────────── */
body.sigmanex-modern-ui .sxwf-hero {
  border: 1px solid #bde3f8 !important;
  border-radius: 23px !important;
  background:
    radial-gradient(circle at 93% -8%, rgba(255,212,77,.28),transparent 32%),
    radial-gradient(circle at 72% 95%,rgba(66,199,248,.19),transparent 39%),
    linear-gradient(128deg, #fff 0%, #f5fcff 52%, #e7f8ff 100%) !important;
  box-shadow: 0 11px 30px rgba(19, 117, 174, .065) !important;
}
body.sigmanex-modern-ui .sxwf-kicker {
  background: #e3f7ff !important;
  color: #1173ae !important;
  border-color: #bde8fa !important;
}
body.sigmanex-modern-ui .sxwf-title { color: #115586 !important; }
body.sigmanex-modern-ui .sxwf-role {
  background: #fff !important;
  border: 1px solid #cde8f7 !important;
  color: #326887;
}
body.sigmanex-modern-ui .sxwf-btn:not(.secondary):not(.danger):not(.success) {
  background: linear-gradient(123deg, #149be0 0%, #146bc0 100%) !important;
  border-color: rgba(8,112,185,.14) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(13,119,197,.17) !important;
}
body.sigmanex-modern-ui .sxwf-btn:not(.secondary):not(.danger):not(.success):hover {
  filter: brightness(1.05);
}
body.sigmanex-modern-ui .sxwf-btn.secondary {
  background: #fff !important;
  border: 1px solid #c5e3f5 !important;
  color: #1b618e !important;
  box-shadow: 0 3px 10px rgba(14, 113, 190, .04) !important;
}
body.sigmanex-modern-ui .sxwf-btn.secondary:hover {
  background: #effaff !important;
  border-color: #90d7f7 !important;
}
body.sigmanex-modern-ui .sxwf-panel,
body.sigmanex-modern-ui .sxwf-card,
body.sigmanex-modern-ui .sxwf-launch-card,
body.sigmanex-modern-ui .sxwf-stat {
  border: 1px solid #d2e9f8 !important;
  background: linear-gradient(140deg, #fff, #fafdff) !important;
  box-shadow: 0 8px 23px rgba(16, 117, 175, .05) !important;
}
body.sigmanex-modern-ui .sxwf-panel,
body.sigmanex-modern-ui .sxwf-launch-card { border-radius: 18px !important; }
body.sigmanex-modern-ui .sxwf-card,
body.sigmanex-modern-ui .sxwf-stat { border-radius: 16px !important; }
body.sigmanex-modern-ui .sxwf-panel h3,
body.sigmanex-modern-ui .sxwf-card strong,
body.sigmanex-modern-ui .sxwf-stat strong { color: #204c72; }
body.sigmanex-modern-ui .sxwf-stat::before {
  background: linear-gradient(#60d0ff, #1689d0) !important;
}
body.sigmanex-modern-ui .sxwf-stat:nth-child(3n + 2)::before {
  background: linear-gradient(#ffe891, #f4b51a) !important;
}
body.sigmanex-modern-ui .sxwf-chip {
  background: #f0faff !important;
  border-color: #d5ebf9 !important;
  color: #3e708f !important;
}
body.sigmanex-modern-ui .sxwf-chip:hover { background: #e4f6ff !important; }
body.sigmanex-modern-ui .sxwf-chip.active {
  background: #dbf2ff !important;
  border-color: #7dcefa !important;
  color: #095b99 !important;
  box-shadow: inset 0 0 0 1px rgba(18,146,218,.07);
}
body.sigmanex-modern-ui .sxwf-launch-card:first-child {
  background: linear-gradient(115deg, #fff, #f0fbff) !important;
  border-color: #c7e9f9 !important;
}
body.sigmanex-modern-ui .sxwf-launch-card:nth-child(2) {
  background: linear-gradient(115deg, #fff, #fffbeb) !important;
  border-color: #f3e3ae !important;
}
body.sigmanex-modern-ui .sxwf-launch-card:first-child .sxwf-launch-icon {
  background: #ddf5ff !important;
  color: #1474b7 !important;
}
body.sigmanex-modern-ui .sxwf-launch-card:nth-child(2) .sxwf-launch-icon {
  background: #fff3c9 !important;
  color: #b57800 !important;
}
body.sigmanex-modern-ui .sxwf-launch-title { color: #1b527a !important; }
body.sigmanex-modern-ui .sxwf-launch-desc { color: #738fa2 !important; }
body.sigmanex-modern-ui .sxwf-modal {
  border: 1px solid #cfe6f6 !important;
  background: #fbfeff !important;
  box-shadow: 0 27px 90px rgba(5, 84, 147, .21) !important;
}
body.sigmanex-modern-ui .sxwf-modal-head {
  background: linear-gradient(90deg, #fff, #f0faff) !important;
  border-bottom-color: #d9eefb !important;
}
body.sigmanex-modern-ui .sxwf-input,
body.sigmanex-modern-ui .sxwf-select,
body.sigmanex-modern-ui .sxwf-textarea {
  background: #fff !important;
  border-color: #cfe6f5 !important;
  color: #23435f !important;
}
body.sigmanex-modern-ui .sxwf-input:focus,
body.sigmanex-modern-ui .sxwf-select:focus,
body.sigmanex-modern-ui .sxwf-textarea:focus {
  border-color: #4cc0f2 !important;
  box-shadow: 0 0 0 3px rgba(30, 176, 242, .14) !important;
}
body.sigmanex-modern-ui .sxwf-detail-tabs { background: #e8f7ff !important; }
body.sigmanex-modern-ui .sxwf-detail-tabs button.active {
  color: #116cae !important;
  border-bottom: 2px solid #ffcd42 !important;
}
body.sigmanex-modern-ui .sxwf-timeline-icon { background: #e2f5ff; color: #0b74c0; }
body.sigmanex-modern-ui .sxwf-photo { border-color: #cce5f6; }
body.sigmanex-modern-ui .sxwf-history-item { border-color: #d4eaf7; }

/* Preserve semantic late/reject/danger RED and completed/success GREEN.
   Yellow is an accent, not a substitute for critical safety states. */
body.sigmanex-modern-ui .sxwf-live-timer.late,
body.sigmanex-modern-ui .sxwf-performance.late,
body.sigmanex-modern-ui .sxwf-history-item.late,
body.sigmanex-modern-ui .sxwf-card.rejected { border-color: #f4b3b3 !important; }
body.sigmanex-modern-ui .sxwf-alert.warning,
body.sigmanex-modern-ui .sxwf-alert.warn,
body.sigmanex-modern-ui .sxdash-badge.amber {
  background: #fff8df !important;
  border-color: #f4d98a !important;
  color: #906104 !important;
}

/* ── Mobile and motion preferences ─────────────────────────────────────── */
@media (max-width: 1023px) {
  body.sigmanex-modern-ui aside {
    box-shadow: 18px 0 50px rgba(5, 67, 124, .24) !important;
  }
  body.sigmanex-modern-ui .sxwf-hero { border-radius: 19px !important; }
}
@media (max-width: 640px) {
  body.sigmanex-modern-ui .sxwf-hero { padding: 17px !important; }
  body.sigmanex-modern-ui .sxwf-launch-card { padding: 15px !important; }
  body.sigmanex-modern-ui .sxdash-kpi { border-radius: 15px !important; }
  body.sigmanex-modern-ui .sxdash-panel { border-radius: 16px !important; }
  body.sigmanex-modern-ui main .bg-card.rounded-xl.border {
    border-radius: 15px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.sigmanex-modern-ui .sxdash-kpi,
  body.sigmanex-modern-ui .sxwf-card,
  body.sigmanex-modern-ui .sxwf-launch-card {
    transition: none !important;
  }
}
