:root {
  --safeepi-navy: #0b1f2e;
  --safeepi-navy-soft: #102b3e;
  --safeepi-green: #006747;
  --safeepi-green-dark: #00563c;
  --safeepi-green-bright: #0a8f60;
  --safeepi-lime: #b7f235;
  --safeepi-amber: #ffb000;
  --safeepi-orange: #f47a16;
  --safeepi-red: #e52929;
  --safeepi-ink: #102033;
  --safeepi-muted: #65758a;
  --safeepi-line: #dce3e9;
  --safeepi-canvas: #f6f8fa;
  --safeepi-white: #ffffff;
  --safeepi-radius: 10px;
  --safeepi-font: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
}

html { background: var(--safeepi-canvas); }

body.safeepi-modern {
  color: var(--safeepi-ink);
  background: var(--safeepi-canvas);
  font-family: var(--safeepi-font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.safeepi-modern aside.w-64 {
  width: 250px;
  background: linear-gradient(180deg, var(--safeepi-navy) 0%, #0c2638 100%);
  color: #f5f8fa;
  border-right: 1px solid rgba(255,255,255,.06);
}

body.safeepi-modern aside.w-64 > div:first-child {
  min-height: 102px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

body.safeepi-modern aside.w-64 > div:first-child > div:first-child,
body.safeepi-modern header.md\:hidden > div > div:nth-child(2) {
  width: 42px;
  height: 42px;
  color: var(--safeepi-navy);
  background: var(--safeepi-amber);
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(255,176,0,.16);
}

body.safeepi-modern aside.w-64 nav {
  padding: 14px 14px 20px;
}

body.safeepi-modern aside.w-64 nav a,
body.safeepi-modern aside.w-64 nav button {
  min-height: 48px;
  border-radius: 7px;
  color: #c8d4dc;
  font-size: 14px;
  box-shadow: none;
  outline: none;
}

body.safeepi-modern aside.w-64 nav a:hover,
body.safeepi-modern aside.w-64 nav button:hover {
  color: #fff;
  background: rgba(255,255,255,.055);
}

body.safeepi-modern aside.w-64 nav a.bg-emerald-800 {
  color: var(--safeepi-lime);
  background: rgba(183,242,53,.045);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: none;
}

body.safeepi-modern aside.w-64 nav > div,
body.safeepi-modern aside.w-64 nav > button {
  color: #8ea2b1;
  letter-spacing: .055em;
}

body.safeepi-modern aside.w-64 nav svg { width: 21px; height: 21px; }

body.safeepi-modern aside.w-64 > div:last-child {
  padding: 18px;
  border-color: rgba(255,255,255,.08);
}

body.safeepi-modern aside.w-64 select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: #eef4f7;
  background: rgba(0,0,0,.15);
  border-color: rgba(255,255,255,.22);
  border-radius: 6px;
}

body.safeepi-modern main {
  background: var(--safeepi-canvas);
}

body.safeepi-modern main > header:first-of-type {
  min-height: 102px;
  padding: 20px 30px 20px 32px;
  color: #fff;
  background: linear-gradient(100deg, var(--safeepi-green-dark), var(--safeepi-green));
  border: 0;
}

.safeepi-welcome {
  display: block !important;
  color: #fff !important;
  font-size: 19px !important;
  line-height: 1.25;
}

.safeepi-welcome::after {
  content: "Visão geral do sistema de gestão de EPIs";
  display: block;
  margin-top: 6px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 400;
}

.safeepi-welcome span { color: #fff !important; }

.safeepi-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  margin-right: 22px;
}

.safeepi-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.safeepi-header-action:hover { transform: translateY(-1px); }
.safeepi-header-action svg { width: 20px; height: 20px; }

.safeepi-header-action--primary {
  color: #112719;
  background: var(--safeepi-lime);
  box-shadow: 0 8px 18px rgba(47,74,12,.2);
}

.safeepi-header-action--primary:hover { background: #c5fb4d; }

.safeepi-header-action--secondary {
  color: #fff;
  background: rgba(0,0,0,.1);
  border: 1px solid rgba(255,255,255,.55);
}

.safeepi-header-action--secondary:hover { background: rgba(255,255,255,.1); }

body.safeepi-modern main > header:first-of-type > div:last-child > div {
  color: var(--safeepi-green-dark);
  background: #cef4e4;
  width: 46px;
  height: 46px;
  font-size: 14px;
}

body.safeepi-modern main > .flex-1 { padding: 24px 30px 38px; }

.safeepi-dashboard {
  max-width: 1240px !important;
  margin-inline: auto;
  gap: 0 !important;
}

.safeepi-dashboard-intro {
  margin-bottom: 14px;
}

.safeepi-dashboard-intro h1 {
  color: var(--safeepi-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.safeepi-dashboard-intro p {
  display: none;
}

.safeepi-metrics {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 !important;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--safeepi-white);
  border: 1px solid var(--safeepi-line);
  border-radius: var(--safeepi-radius);
}

.safeepi-metric {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 14px;
  min-height: 134px;
  padding: 24px 20px !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.safeepi-metric + .safeepi-metric::before {
  content: "";
  position: absolute;
  inset-block: 20px;
  left: 0;
  width: 1px;
  background: var(--safeepi-line);
}

.safeepi-metric-icon {
  grid-row: 1 / 4;
  align-self: center;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--safeepi-green-bright);
  background: #e9f7f0;
  border-radius: 11px;
}

.safeepi-metric:nth-child(4) .safeepi-metric-icon {
  color: var(--safeepi-red);
  background: #ffebeb;
}

.safeepi-metric-icon svg { width: 24px; height: 24px; }

.safeepi-metric > p:first-of-type {
  margin: 0 0 2px;
  color: #6f7e90;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.safeepi-metric > p:nth-of-type(2) {
  color: var(--safeepi-ink);
  font-size: 30px;
  line-height: 1.05;
}

.safeepi-metric:nth-child(1) > p:nth-of-type(2),
.safeepi-metric:nth-child(2) > p:nth-of-type(2) { color: var(--safeepi-green-bright); }
.safeepi-metric:nth-child(4) > p:nth-of-type(2) { color: var(--safeepi-red); }

.safeepi-metric > div:last-child {
  margin-top: 5px;
  color: var(--safeepi-muted);
  font-size: 11px;
}
.safeepi-metric > div:last-child svg { display: none; }

.safeepi-command-center {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr);
  gap: 0;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--safeepi-line);
  border-radius: var(--safeepi-radius);
}

.safeepi-priority { padding: 18px 20px; }

.safeepi-section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.safeepi-section-heading > svg {
  width: 22px;
  height: 22px;
  color: var(--safeepi-orange);
}

.safeepi-section-heading h2,
.safeepi-quick-actions h2 {
  color: var(--safeepi-ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.safeepi-section-heading p {
  margin-top: 2px;
  color: var(--safeepi-muted);
  font-size: 11px;
}

.safeepi-alert-count {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding-inline: 7px;
  margin-left: 3px;
  color: #fff;
  background: var(--safeepi-red);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.safeepi-priority-rows {
  overflow: hidden;
  border: 1px solid #e4e8ec;
  border-radius: 7px;
}

.safeepi-priority-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(190px, 1fr) minmax(150px, .75fr) 72px 18px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  color: var(--safeepi-ink);
  background: #fff;
  border-left: 3px solid var(--safeepi-orange);
  transition: background .15s ease;
}

.safeepi-priority-row + .safeepi-priority-row { border-top: 1px solid #e4e8ec; }
.safeepi-priority-row:hover { background: #fafcfd; }
.safeepi-priority-row--critical { border-left-color: var(--safeepi-red); background: #fff8f8; }

.safeepi-priority-icon { color: var(--safeepi-orange); }
.safeepi-priority-row--critical .safeepi-priority-icon { color: var(--safeepi-red); }
.safeepi-priority-icon svg { width: 22px; height: 22px; }

.safeepi-priority-copy { display: flex; flex-direction: column; min-width: 0; }
.safeepi-priority-copy small { color: var(--safeepi-muted); font-size: 10px; }
.safeepi-priority-copy strong { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.safeepi-priority-value { color: var(--safeepi-orange); font-size: 11px; font-weight: 750; }
.safeepi-priority-row--critical .safeepi-priority-value { color: var(--safeepi-red); }

.safeepi-priority-badge {
  justify-self: end;
  padding: 5px 8px;
  color: #fff;
  background: var(--safeepi-orange);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.safeepi-priority-row--critical .safeepi-priority-badge { background: var(--safeepi-red); }
.safeepi-priority-arrow { width: 16px; height: 16px; color: #607084; }

.safeepi-quick-actions {
  padding: 18px 20px;
  border-left: 1px solid var(--safeepi-line);
}

.safeepi-quick-actions h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
  color: var(--safeepi-green);
}
.safeepi-quick-actions h2 svg { width: 19px; height: 19px; }

.safeepi-quick-link {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 0;
  border-radius: 6px;
}
.safeepi-quick-link:hover { background: #f6faf8; }

.safeepi-quick-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: var(--safeepi-green-bright);
}
.safeepi-quick-icon svg { width: 21px; height: 21px; }
.safeepi-quick-link > span:last-child { display: flex; flex-direction: column; }
.safeepi-quick-link strong { color: var(--safeepi-ink); font-size: 11.5px; }
.safeepi-quick-link small { margin-top: 2px; color: var(--safeepi-muted); font-size: 10px; }

.safeepi-chart-grid,
.safeepi-alert-details {
  gap: 14px !important;
  margin-top: 0 !important;
  margin-bottom: 14px;
}

.safeepi-chart-grid > div,
.safeepi-alert-details > div,
body.safeepi-modern main .bg-white.rounded-xl.border {
  border-color: var(--safeepi-line);
  border-radius: var(--safeepi-radius);
  box-shadow: none;
}

.safeepi-chart-grid > div > div:first-child,
.safeepi-alert-details > div > div:first-child {
  min-height: 51px;
  padding: 15px 16px;
}

.safeepi-chart-grid h2,
.safeepi-alert-details h2 {
  color: var(--safeepi-ink);
  font-size: 13px;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.safeepi-chart-grid .h-\[300px\] {
  flex: none !important;
  height: 230px !important;
  min-height: 230px;
  padding: 14px 18px;
}
.safeepi-secondary-insights { display: grid !important; }

.safeepi-alert-details li { min-height: 66px; padding: 13px 16px; }
.safeepi-alert-details li p { font-size: 11px; }
.safeepi-alert-details li p.font-medium { font-size: 12px; }

body.safeepi-modern button,
body.safeepi-modern a,
body.safeepi-modern input,
body.safeepi-modern select,
body.safeepi-modern textarea {
  transition-duration: 160ms;
}

body.safeepi-modern input:not([type="checkbox"]):not([type="radio"]),
body.safeepi-modern textarea,
body.safeepi-modern main select {
  border-color: #cfd8df;
  border-radius: 7px;
  background-color: #fff;
}

body.safeepi-modern input:focus,
body.safeepi-modern textarea:focus,
body.safeepi-modern select:focus,
body.safeepi-modern a:focus-visible,
body.safeepi-modern button:focus-visible {
  outline: 3px solid rgba(183,242,53,.42);
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .safeepi-header-action--secondary { display: none; }
  .safeepi-command-center { grid-template-columns: 1fr; }
  .safeepi-quick-actions { border-top: 1px solid var(--safeepi-line); border-left: 0; }
  .safeepi-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .safeepi-quick-actions h2 { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .safeepi-metrics { grid-template-columns: repeat(2, 1fr); }
  .safeepi-metric:nth-child(3)::before { display: none; }
  .safeepi-metric:nth-child(n+3) { border-top: 1px solid var(--safeepi-line) !important; }
  .safeepi-priority-row { grid-template-columns: 30px minmax(160px, 1fr) auto 16px; }
  .safeepi-priority-value { grid-column: 2 / 3; }
  .safeepi-priority-badge { grid-column: 3 / 4; grid-row: 1 / 3; }
  .safeepi-priority-arrow { grid-column: 4 / 5; grid-row: 1 / 3; }
}

@media (max-width: 767px) {
  body.safeepi-modern main > header.md\:hidden {
    min-height: 66px;
    padding: 12px 16px;
    background: linear-gradient(100deg, var(--safeepi-navy), var(--safeepi-green-dark));
  }
  body.safeepi-modern main > .flex-1 { padding: 18px 14px 28px; }
  .safeepi-dashboard-intro { margin-bottom: 10px; }
  .safeepi-metrics { grid-template-columns: 1fr 1fr; }
  .safeepi-metric { grid-template-columns: 38px 1fr; min-height: 112px; padding: 16px 12px !important; column-gap: 9px; }
  .safeepi-metric-icon { width: 36px; height: 36px; border-radius: 8px; }
  .safeepi-metric-icon svg { width: 19px; height: 19px; }
  .safeepi-metric > p:first-of-type { font-size: 8px; }
  .safeepi-metric > p:nth-of-type(2) { font-size: 24px; }
  .safeepi-metric > div:last-child { font-size: 9px; }
  .safeepi-command-center { display: block; }
  .safeepi-priority { padding: 14px 12px; }
  .safeepi-priority-row { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 9px 8px; }
  .safeepi-priority-icon svg { width: 19px; height: 19px; }
  .safeepi-priority-value { grid-column: 2 / 3; }
  .safeepi-priority-badge { grid-column: 3; grid-row: 1 / 3; }
  .safeepi-priority-arrow { display: none; }
  .safeepi-quick-actions { display: block; padding: 16px 14px; }
  .safeepi-quick-link { padding: 9px 0; }
  .safeepi-chart-grid .h-\[300px\] { height: 220px !important; min-height: 220px; padding: 10px; }
}

@media print {
  .safeepi-header-actions,
  .safeepi-command-center { display: none !important; }
}
