:root {
  /* Paleta principal */
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --green-soft: #eff6ff;
  --mint: #eff6ff;
  --amber: #c77700;
  --red: #b42318;
  --white: #ffffff;
  /* Texto */
  --text: #1f2933;
  --ink: #1f2933;
  --muted: #5f6b7a;
  /* Backgrounds */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --surface-panel: #ffffff;
  /* Bordas */
  --line: #d9e2ec;
  --border-ui: #dbe3ec;
  --border-control: #cfd8e3;
  --border-muted: #e2e8f0;
  /* Tabelas */
  --row-border: #e5eaf0;
  --row-hover: #f5f9fc;
  /* Menu */
  --nav-active-bg: #eff6ff;
  --nav-hover-bg: #f3f6f9;
  /* Alertas */
  --attention-bg: #fff7ed;
  --attention-border: #fed7aa;
  --danger-soft: #fff1f2;
  --danger-border: #fecdd3;
  /* Interação */
  --focus: rgba(37, 99, 235, 0.14);
  --shadow-sm: 0 1px 2px rgba(31, 41, 51, 0.06);
  --shadow-md: 0 12px 28px rgba(31, 41, 51, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 220px);
  font-family: Arial, Helvetica, sans-serif;
  display: grid;
  grid-template-columns: 280px 1fr;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: var(--green);
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

button.secondary {
  background: white;
  color: var(--green-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.danger {
  background: #fee4e2;
  color: var(--red);
  border: 1px solid #fecdca;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: white;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  display: grid;
  inset: 0;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  position: fixed;
  z-index: 100;
}

.login-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 14px;
  max-width: 440px;
  padding: 28px;
  width: 100%;
}

.login-card h1 {
  font-size: 28px;
}

.login-card small {
  color: var(--muted);
  text-align: center;
}

.login-brand {
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
}

.login-heading {
  display: grid;
  gap: 4px;
}

.login-heading span {
  color: var(--muted);
}

.login-card #loginButton {
  margin-top: 4px;
  min-height: 44px;
}

.user-badge {
  background: var(--mint);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
}

.sidebar {
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid var(--line);
  padding: 16px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.04);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-weight: 800;
  font-size: 24px;
}

.brand span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 0;
}

nav {
  display: grid;
  gap: 2px;
}

.menu-group {
  display: grid;
  gap: 2px;
  margin: 10px 0 4px;
}

.menu-group:first-child {
  margin-top: 0;
}

.menu-group-title {
  align-items: center;
  background: transparent;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding: 7px 14px 3px;
  width: 100%;
}

.menu-group-title:hover {
  background: transparent;
  color: var(--green-dark);
}

.menu-group-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* Chevron via CSS — substitui o <strong>+/-</strong> gerado pelo JS */
.menu-group-title::after {
  content: "▾";
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.15s ease;
}

.menu-group-title[aria-expanded="false"]::after {
  content: "▸";
}

.menu-group-items {
  display: grid;
  gap: 2px;
}

nav button {
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  padding: 9px 14px;
  box-shadow: none;
}

nav button.active,
nav button:hover {
  background: var(--mint);
  color: var(--green-dark);
}

.app-shell {
  padding: 26px 28px;
  min-width: 0;
}

.topbar {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.topbar,
.section-head,
.filters,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.section-head {
  justify-content: space-between;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: white;
  color: var(--green-dark);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.toast.error {
  border-left-color: var(--red);
  color: var(--red);
}

.section-head {
  margin-top: 6px;
}

.section-head h2 {
  font-size: 22px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 19px;
}

.filters {
  margin: 20px 0;
}

.filters input {
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.03);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.dashboard-groups {
  display: grid;
  gap: 18px;
}

.attention-panel {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.attention-panel h2 {
  font-size: 20px;
  margin: 2px 0 0;
}

.attention-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.attention-item {
  background: #fff7f7;
  border: 1px solid #fecdca;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  padding: 9px 10px;
}

.attention-item.warn {
  background: #fffaf0;
  border-color: #f6d59a;
}

.attention-item span {
  color: var(--muted);
}

.attention-item strong {
  color: var(--red);
}

.attention-item.warn strong {
  color: var(--amber);
}

.attention-ok {
  background: var(--green-soft);
  border-radius: 8px;
  color: var(--green-dark);
  padding: 10px 12px;
}

.dashboard-group {
  min-width: 0;
}

.dashboard-group h2 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.dashboard-group .cards {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.card,
.split section,
.answer,
dialog {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.card {
  padding: 18px;
}

.card span {
  color: var(--muted);
  font-size: 13px;
}

.card strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.orientation-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.orientation-box p {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.orientation-box strong,
.orientation-box span {
  display: block;
}

.orientation-box strong {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.card.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card.clickable:hover,
.card.clickable:focus {
  border-color: var(--green);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.card.warn {
  border-color: #f6d59a;
  background: #fffaf0;
}

.card.warn strong {
  color: var(--amber);
}

.card.danger {
  border-color: #fecdca;
  background: #fff7f7;
}

.card.danger strong {
  color: var(--red);
}

.card.muted-card {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: none;
}

.card.muted-card span,
.card.muted-card strong {
  color: #64748b;
}

.card.muted-card strong {
  font-size: 26px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.split section {
  padding: 16px;
}

.bars {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  gap: 5px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--mint);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--green);
}

.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}

.table-wrap:has(.action-menu[open]) {
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fafc;
}

tr.equipment-group-start td {
  border-top: 3px solid var(--green);
  background: #f8fafc;
}

tr.missing-action-plan td {
  background: #fffaf0;
}

tr.missing-action-plan td:first-child {
  border-left: 4px solid var(--amber);
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.status.muted {
  background: #eef1f4;
  color: #64748b;
}

.status.warn {
  background: #fff5df;
  color: var(--amber);
}

.status.danger {
  background: #fee4e2;
  color: var(--red);
}

.status.success {
  background: var(--green-soft);
  color: var(--green-dark);
}

.evidence-group {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

button.small {
  padding: 7px 10px;
  font-size: 12px;
}

.row-actions,
.linked-evidence-actions,
.attachment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions {
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  position: relative;
  white-space: nowrap;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-dark);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  line-height: 1;
  list-style: none;
  min-width: 64px;
  padding: 0 10px;
}

.row-primary-action {
  min-width: 86px;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu[open] summary {
  background: var(--mint);
  border-color: #dbeafe;
}

.action-menu-list {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 4px;
  min-width: 168px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: 38px;
  z-index: 20;
}

.action-menu-list button {
  box-shadow: none;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.records-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.daily-progress {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 10px;
  padding: 11px 13px;
  box-shadow: var(--shadow-sm);
}

.daily-progress span {
  color: var(--muted);
  font-weight: 700;
}

.table-empty {
  padding: 16px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assistant-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin: 14px 0;
}

.search-examples {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.search-examples span {
  margin-right: 2px;
}

.answer {
  padding: 16px;
  min-height: 120px;
}

.search-section-row td {
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}

.search-result-cards {
  display: grid;
  gap: 10px;
}

.search-result-card {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 14px 16px;
}

.search-result-card h3 {
  font-size: 17px;
  margin: 4px 0;
}

.search-result-card p {
  color: var(--muted);
  margin: 0 0 8px;
}

.search-result-module {
  background: var(--green-soft);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  color: var(--green-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
  padding: 4px 8px;
}

.trainings-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.training-participants {
  background: var(--mint);
  border: 1px solid var(--line);
  border-radius: 8px;
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 14px;
}

.training-participants p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 10px;
}

.training-participants #participantFilter {
  margin-bottom: 8px;
  width: 100%;
}

.participant-list {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.participant-item {
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 8px;
  padding: 6px 8px;
}

.participant-item:hover {
  background: var(--mint);
}

.participant-item input[type="checkbox"],
.sector-training-check,
.role-training-check {
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  width: 16px;
}

.participant-done {
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  padding: 2px 8px;
}

.search-result-card mark {
  background: #fef08a;
  border-radius: 3px;
  color: inherit;
  padding: 0 1px;
}

.search-snippet {
  background: var(--mint);
  border-left: 3px solid var(--green-dark);
  border-radius: 6px;
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  padding: 8px 10px;
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-result-meta span,
.search-section-card {
  background: var(--mint);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 12px;
  padding: 5px 8px;
}

.search-section-card {
  border-radius: 8px;
  font-weight: 800;
}

.search-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.bulk-equipment-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 14px 0 8px;
}

.bulk-equipment-head small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.bulk-equipment-actions,
.bulk-equipment-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk-equipment-tools {
  margin-bottom: 8px;
}

.bulk-equipment-tools input[type="search"] {
  flex: 1 1 320px;
  margin: 0;
}

.bulk-equipment-tools label {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  margin: 0;
}

.bulk-equipment-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  max-height: 280px;
  overflow: auto;
}

.bulk-equipment-option {
  align-items: center;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
}

.bulk-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.bulk-type-badge.is-instrument { background: #eef2ff; color: #4338ca; }
.bulk-type-badge.is-equipment { background: #ecfdf5; color: #0f7a4d; }

.bulk-equipment-option:hover {
  background: var(--mint);
}

.bulk-equipment-option span {
  flex: 1 1 auto;
}

.bulk-equipment-option em {
  background: var(--yellow-soft, #fef3c7);
  border-radius: 999px;
  color: var(--yellow-dark, #92400e);
  flex: 0 0 auto;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  padding: 3px 8px;
}

.bulk-equipment-done {
  background: var(--green-soft);
}

.bulk-equipment-done em {
  background: white;
  color: var(--green-dark);
}

.bulk-equipment-option:last-child {
  border-bottom: 0;
}

.bulk-equipment-option small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

dialog {
  width: min(840px, calc(100vw - 24px));
  padding: 20px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.form-section-title {
  border-bottom: 1px solid var(--border-ui, var(--line));
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  grid-column: 1 / -1;
  letter-spacing: 0.04em;
  margin: 16px 0 0;
  padding: 8px 0 6px;
  text-transform: uppercase;
}

/* Primeira seção do formulário não precisa de margem extra no topo */
.form-grid > .form-section-title:first-child {
  margin-top: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label.required-field {
  color: var(--ink);
  font-weight: 700;
}

/* Asterisco vermelho inline após o texto do label (via .label-name injetado pelo JS) */
label.required-field .label-name::after {
  content: " *";
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

label.required-field input,
label.required-field select,
label.required-field textarea {
  border-color: #cbd5e1;
  box-shadow: inset 3px 0 0 rgba(37, 99, 235, 0.45);
}

#recordForm.was-submitted label.required-field input:invalid,
#recordForm.was-submitted label.required-field select:invalid,
#recordForm.was-submitted label.required-field textarea:invalid {
  border-color: #f2a9a9;
  box-shadow: inset 3px 0 0 rgba(180, 35, 24, 0.45);
}

.validation-guide {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #22c55e;
  border-radius: 8px;
  color: #166534;
  font-size: 13px;
  grid-column: 1 / -1;
  line-height: 1.45;
  padding: 10px 12px;
}

.validation-guide strong {
  display: block;
  margin-bottom: 2px;
}

.validation-suggestion {
  background: #f8fafc;
  border: 1px solid #dbe7ef;
  border-left: 4px solid #5f6b7a;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  grid-column: 1 / -1;
  padding: 10px 12px;
}

.validation-suggestion.success {
  background: #f0fdf4;
  border-left-color: #22c55e;
  color: #166534;
}

.validation-suggestion.danger {
  background: #fff1f2;
  border-left-color: #ef4444;
  color: #991b1b;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-field input {
  width: auto;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
}

.dropzone {
  border: 1px dashed var(--green);
  padding: 18px;
  border-radius: 8px;
  grid-column: 1 / -1;
}

.upload-record-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.upload-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.upload-picker-head span {
  color: var(--green-dark);
  font-weight: 700;
}

.upload-record-results {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.upload-record-option {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.upload-record-option:hover {
  background: var(--mint);
  color: var(--green-dark);
}

.upload-record-option small {
  color: var(--muted);
  font-weight: 400;
}

.inline-form,
.link-evidence-form,
.status-editor,
.norm-detail-head,
.norm-badges,
.linked-evidence {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form {
  flex: 1;
  justify-content: flex-end;
}

.inline-form input[type="file"] {
  max-width: 260px;
}

.compact-cards {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin-bottom: 14px;
}

.compact-cards .card strong {
  font-size: 24px;
}

.norm-tree,
.norm-results,
.norm-detail {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.norm-tree,
.norm-results {
  max-height: 680px;
  overflow: auto;
}

.tree-chapter {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.tree-chapter summary {
  cursor: pointer;
  font-weight: 700;
}

.tree-chapter summary span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}

.tree-chapter button,
.requirement-row {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 6px;
}

.tree-chapter button {
  padding: 7px 8px;
  font-weight: 600;
}

.tree-chapter button:hover,
.requirement-row:hover {
  background: var(--mint);
}

.requirement-list {
  display: grid;
  gap: 8px;
}

.requirement-row {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  padding: 10px;
}

.requirement-row span,
.requirement-row small,
.linked-evidence span,
.linked-evidence small {
  color: var(--muted);
}

.requirement-row em {
  justify-self: start;
  font-style: normal;
}

.norm-detail h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.norm-detail p {
  line-height: 1.5;
}

.norm-detail-head {
  justify-content: space-between;
  align-items: flex-start;
}

.norm-badges {
  flex-wrap: wrap;
  margin: 10px 0;
}

.norm-badges span {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.status-editor,
.link-evidence-form {
  align-items: stretch;
}

.link-evidence-form input,
.link-evidence-form select,
.status-editor select {
  min-width: 0;
}

.linked-evidence {
  justify-content: space-between;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  background: #f8fafc;
}

.attachment-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.record-attachment-panel {
  margin-top: 8px;
}

.quick-attachments {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.quick-attachments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-attachments h3 {
  margin: 0;
  font-size: 16px;
}

.quick-upload {
  cursor: pointer;
}

.quick-upload input {
  display: none;
}

.quick-attachment-list {
  display: grid;
  gap: 10px;
}

.attachment-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.attachment-row div:first-child {
  display: grid;
  gap: 4px;
}

.attachment-row small {
  color: var(--muted);
}

.palc-evidence-body {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.palc-evidence-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.palc-evidence-summary article,
.palc-evidence-requirement,
.palc-evidence-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.palc-evidence-summary span {
  color: var(--muted);
  font-size: 12px;
}

.palc-evidence-summary strong {
  display: block;
  font-size: 24px;
  margin-top: 5px;
}

.palc-evidence-requirement h3,
.palc-evidence-group h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.palc-evidence-requirement p {
  margin: 8px 0 0;
  line-height: 1.45;
}

/* Entenda facil (modo estudo da Norma PALC) */
.palc-easy-dialog {
  max-width: 640px;
  width: calc(100% - 40px);
  border-radius: 16px;
}

.palc-easy-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 4px;
}

.palc-easy-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-dark);
  background: #e8f5ee;
  padding: 3px 10px;
  border-radius: 999px;
}

#palcEasyTitle {
  margin: 10px 0 2px;
  font-size: 22px;
}

.palc-easy-chapter {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.palc-easy-body {
  display: grid;
  gap: 12px;
  margin: 16px 0 6px;
}

.palc-easy-ref-wrap {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #f8fafc;
}

.palc-easy-ref-wrap summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.palc-easy-ref {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.palc-easy-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  background: #fff;
}

.palc-easy-card header {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.palc-easy-card p {
  margin: 0;
  line-height: 1.55;
  font-size: 15px;
  color: var(--text);
}

.palc-easy-card.is-pratica {
  border-left-color: #16a34a;
  background: #f2fbf5;
}
.palc-easy-card.is-pratica header { color: #116632; }

.palc-easy-card.is-exemplo {
  border-left-color: #2563eb;
  background: #f1f6fe;
}
.palc-easy-card.is-exemplo header { color: #1d4ed8; }

.palc-easy-card.is-pegadinha {
  border-left-color: #d97706;
  background: #fff8ef;
}
.palc-easy-card.is-pegadinha header { color: #b45309; }

/* Command palette "Ir para…" (Ctrl+K) */
.cmdk-dlg {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 560px;
  width: 92vw;
  box-shadow: 0 24px 70px rgba(15, 42, 30, 0.28);
  overflow: hidden;
}
.cmdk-dlg::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
}
.cmdk-search {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.cmdk-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
.cmdk-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
}
.cmdk-input::placeholder { color: #9aa7b4; }
.cmdk-list {
  max-height: 54vh;
  overflow: auto;
  padding: 8px;
}
.cmdk-dlg .cmdk-item {
  position: relative;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: none !important;
  border-radius: 10px;
  background: transparent;
  box-shadow: none !important;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  transform: none !important;
}
.cmdk-dlg .cmdk-item:hover { background: #f1f5f4; }
.cmdk-dlg .cmdk-item.is-sel { background: #ecfbf2; }
.cmdk-dlg .cmdk-item.is-sel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #16a34a;
}
.cmdk-dlg .cmdk-item.is-sel .cmdk-label { color: #116632; font-weight: 700; }
.cmdk-label { flex: 1; font-weight: 600; }
.cmdk-group {
  font-size: 11.5px;
  color: var(--muted);
  background: #eef2f6;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.cmdk-item.is-sel .cmdk-group { background: #d6f3e2; color: #116632; }
.cmdk-empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.cmdk-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: #fafcfb;
}
.cmdk-foot kbd {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
}

/* Botao gatilho "Ir para…" no cabecalho do painel */
.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.cmdk-trigger:hover {
  border-color: #16a34a;
  color: #116632;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.12);
}
.cmdk-trigger kbd {
  background: #f3f6f4;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
}

/* Secoes e resultados de REGISTROS na paleta (busca universal) */
.cmdk-section {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px 4px;
}
.cmdk-rec-badge {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  color: #1d4ed8;
  background: #e8f0fe;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cmdk-rec .cmdk-label { display: grid; gap: 1px; }
.cmdk-rec-detail { font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* Estrela de favoritar dentro da paleta */
.cmdk-star {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  color: #c7cdd4;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .12s, background .12s, transform .12s;
}
.cmdk-star:hover { color: #f59e0b; background: #fff7ed; transform: scale(1.15); }
.cmdk-star.is-fav { color: #f59e0b; }
.cmdk-foot-star { color: #f59e0b; font-size: 13px; }

/* Grupo/estrela de Favoritos no menu lateral */
#menu .menu-fav-add {
  width: calc(100% - 12px);
  margin: 2px 6px 4px;
  padding: 9px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #116632;
  background: #f2fbf5;
  border: 1px dashed #86e0aa;
  border-radius: 8px;
  cursor: pointer;
}
#menu .menu-fav-add:hover {
  background: #e7f7ee;
  border-color: #16a34a;
  color: #116632;
}
.menu-fav-sub {
  margin: 0 8px 6px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
#menu .menu-group-items button { position: relative; }
#menu .menu-fav {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  line-height: 1;
  color: #f59e0b;
  cursor: pointer;
  padding: 3px;
  border-radius: 5px;
}
#menu .menu-fav:hover { transform: translateY(-50%) scale(1.25); }

/* ============================ Academia PALC (trilha + quiz) */
.acad-head {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.acad-head-txt h2 { margin: 0; font-size: 22px; }
.acad-head-txt p { margin: 5px 0 0; color: var(--muted); font-size: 14px; max-width: 620px; line-height: 1.5; }
.acad-progress {
  flex-shrink: 0; min-width: 190px; text-align: center;
  background: #f2fbf5; border: 1px solid #cdeedd; border-radius: 14px; padding: 12px 18px;
}
.acad-progress-num { font-size: 26px; font-weight: 800; color: #116632; line-height: 1.1; }
.acad-progress-label { font-size: 12px; color: var(--muted); }
.acad-progress-bar { height: 7px; border-radius: 999px; background: #dcefe4; margin-top: 8px; overflow: hidden; }
.acad-progress-bar span { display: block; height: 100%; background: #16a34a; border-radius: 999px; transition: width .4s; }
.acad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.acad-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.acad-card:hover { border-color: #16a34a; box-shadow: 0 4px 14px rgba(22,163,74,.12); transform: translateY(-1px); }
.acad-card.is-disabled { cursor: default; opacity: .6; }
.acad-card.is-disabled:hover { border-color: var(--line); box-shadow: none; transform: none; }
.acad-card.is-done { border-color: #bfe6cf; background: #f6fdf9; }
.acad-card-num {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #116632; background: #e8f7ef;
}
.acad-card.is-done .acad-card-num { color: #fff; background: #16a34a; }
.acad-card-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.acad-card-body strong { color: var(--text); font-size: 14.5px; line-height: 1.3; }
.acad-card-meta { font-size: 12px; color: var(--muted); }
.acad-chip {
  flex-shrink: 0; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: #eef2f6; color: var(--muted);
}
.acad-chip.is-start { background: #e8f0fe; color: #1d4ed8; }
.acad-chip.is-progress { background: #fff4e5; color: #9a4a06; }
.acad-chip.is-done { background: #dcf5e6; color: #116632; }
.acad-chip.is-soon { background: #f1f5f9; color: #5f6b7a; }

/* Capítulo: estudo + quiz */
.acad-chapter-head { margin: 10px 0 6px; }
.acad-chapter-head h2 { font-size: 21px; }
.acad-study-wrap {
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 14px; margin-bottom: 18px; background: #fbfdfc;
}
.acad-study-wrap summary { cursor: pointer; font-weight: 700; color: #116632; padding: 6px 0; }
.acad-study { border-top: 1px solid var(--line); padding: 12px 2px; }
.acad-study:first-of-type { border-top: none; }
.acad-study header { font-size: 13px; color: var(--muted); line-height: 1.45; }
.acad-study-item {
  display: inline-block; font-weight: 800; color: #116632; background: #e8f7ef;
  border-radius: 6px; padding: 1px 7px; margin-right: 4px;
}
.acad-study-easy { margin-top: 8px; display: grid; gap: 7px; }
.ez { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); padding: 8px 12px; border-radius: 9px; border-left: 4px solid; }
.ez-p { background: #f2fbf5; border-left-color: #16a34a; }
.ez-e { background: #f1f6fe; border-left-color: #2563eb; }
.ez-w { background: #fff8ef; border-left-color: #d97706; }
.acad-study-none { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }

.acad-quiz h3 { font-size: 16px; margin: 0 0 12px; }
.acad-q {
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: #fff;
}
.acad-q.is-ok { border-left-color: #16a34a; background: #f6fdf9; }
.acad-q.is-wrong { border-left-color: #dc2626; background: #fef5f5; }
.acad-q-title { margin: 0 0 10px; font-weight: 600; color: var(--text); font-size: 14.5px; display: flex; gap: 8px; }
.acad-q-n {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; background: #eef2f6; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.acad-q-opts { display: grid; gap: 6px; }
.acad-opt {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--text); transition: background .12s, border-color .12s;
}
.acad-opt:hover { background: #f6f8fa; }
.acad-opt input { accent-color: #16a34a; }
.acad-opt.opt-correct { background: #eafaf0; border-color: #16a34a; font-weight: 600; }
.acad-opt.opt-wrong { background: #fdecec; border-color: #dc2626; }
.acad-q-why { margin: 10px 0 0; font-size: 13px; color: #475569; background: #f8fafc; border-radius: 8px; padding: 8px 12px; line-height: 1.5; }
.acad-quiz-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.acad-quiz-msg { color: #b91c1c; font-size: 13px; font-weight: 600; }
.acad-result { margin-top: 16px; padding: 14px 18px; border-radius: 12px; font-size: 15px; line-height: 1.6; }
.acad-result.is-pass { background: #eafaf0; border: 1px solid #a7e3bf; color: #116632; }
.acad-result.is-fail { background: #fff4e5; border: 1px solid #f5d59a; color: #b45309; }
.acad-result button { margin-left: 6px; }

/* ============================ Incerteza de Medição (11.8) */
.mu-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.mu-head-txt h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.mu-tag { font-size: 11px; font-weight: 800; color: #1d4ed8; background: #e8f0fe; border-radius: 999px; padding: 3px 9px; letter-spacing: .03em; }
.mu-head-txt p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; max-width: 720px; }
.mu-head-txt em { font-style: normal; font-family: var(--font-mono, monospace); color: var(--text); background: #f1f5f4; padding: 0 5px; border-radius: 4px; }
.mu-periods { display: flex; gap: 6px; flex-shrink: 0; }
.mu-period { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; cursor: pointer; }
.mu-period.is-on { background: #eef7f2; border-color: #16a34a; color: #116632; }
.mu-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mu-sum { flex: 1; min-width: 120px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 13px; color: var(--muted); }
.mu-sum span { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--text); }
.mu-sum.is-ok { background: #f2fbf5; border-color: #bfe6cf; } .mu-sum.is-ok span { color: #116632; }
.mu-sum.is-warn { background: #fff8ef; border-color: #f5d59a; } .mu-sum.is-warn span { color: #b45309; }
.mu-sum.is-neutral { background: #f6f8fa; } .mu-sum.is-neutral span { color: #64748b; }
.mu-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.mu-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mu-table thead th { text-align: left; background: #f8fafc; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mu-table td { padding: 10px 12px; border-bottom: 1px solid #eef2f6; color: var(--text); vertical-align: top; }
.mu-table tbody tr:last-child td { border-bottom: none; }
.mu-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mu-table th:nth-child(n+3) { text-align: right; }
.mu-um, .mu-abs { color: var(--muted); font-size: 11.5px; }
.mu-prov { font-size: 10.5px; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 5px; padding: 0 5px; }
.mu-chip { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.mu-chip.is-ok { background: #dcf5e6; color: #116632; }
.mu-chip.is-warn { background: #fef2d8; color: #b45309; }
.mu-chip.is-neutral { background: #eef2f6; color: #64748b; }
.mu-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 12px; background: #fbfdfc; }

/* ============================ NPS — Ouvir o Cliente */
.nps-top { display: grid; grid-template-columns: 200px 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 640px) { .nps-top { grid-template-columns: 1fr; } }
.nps-score { border: 2px solid var(--line); border-radius: 16px; padding: 16px; text-align: center; background: #fff; display: flex; flex-direction: column; justify-content: center; }
.nps-score-num { font-size: 52px; font-weight: 800; line-height: 1; }
.nps-score-lbl { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.nps-score-total { font-size: 12px; color: var(--muted); margin-top: 4px; }
.nps-dist { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.nps-dist-bar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: #eef2f6; }
.nps-dist-bar span { display: block; height: 100%; }
.nps-dist-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.nps-dist-legend b { font-size: 15px; }
.nps-block { margin: 16px 0; }
.nps-block h3 { font-size: 15px; margin: 0 0 10px; }
.nps-trend { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.nps-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.nps-bar span { width: 70%; max-width: 34px; border-radius: 5px 5px 0 0; min-height: 4px; }
.nps-bar em { font-size: 10.5px; color: var(--muted); font-style: normal; }
.nps-unit-list { display: grid; gap: 6px; }
.nps-unit-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.nps-unit-row span:first-child { flex: 1; }
.nps-unit-n { color: var(--muted); font-size: 12.5px; }
.nps-unit-row strong { font-size: 16px; min-width: 42px; text-align: right; }
.nps-comment { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.nps-comment.detrator { border-left-color: #ef4444; background: #fff6f6; }
.nps-comment.promotor { border-left-color: #16a34a; }
.nps-comment.neutro { border-left-color: #f59e0b; }
.nps-comment.is-handled { opacity: .72; }
.nps-comment-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.nps-score-badge { color: #fff; font-weight: 800; font-size: 13px; min-width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; }
.nps-cat { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.nps-cat.nps-promotor { background: #dcf5e6; color: #116632; }
.nps-cat.nps-neutro { background: #fdeccb; color: #b45309; }
.nps-cat.nps-detrator { background: #fde0e0; color: #b91c1c; }
.nps-comment-meta { color: var(--muted); margin-left: auto; }
.nps-comment-text { margin: 8px 0 6px; font-size: 14px; color: var(--text); line-height: 1.5; }
.nps-handled { margin: 6px 0 0; font-size: 12.5px; color: #116632; font-weight: 600; }
.nps-share { margin-top: 20px; border: 1px solid #cdeedd; background: #f2fbf5; border-radius: 14px; padding: 16px 18px; }
.nps-share h3 { margin: 0 0 4px; font-size: 16px; color: #116632; }
.nps-share > p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.nps-share-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nps-qr { width: 140px; height: 140px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; flex-shrink: 0; }
.nps-qr svg { width: 100%; height: 100%; display: block; }
.nps-link-box { flex: 1; min-width: 220px; }
.nps-link-box code { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; color: var(--text); word-break: break-all; margin-bottom: 8px; }
.nps-link-box > div { display: flex; gap: 8px; align-items: center; }
.nps-hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.nps-hint code { background: #eef4f0; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Botao "Mostrar todas as abas" do menu curado por papel (A1) */
#menu .menu-showall {
  width: calc(100% - 12px);
  margin: 8px 6px 4px;
  padding: 8px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}
#menu .menu-showall:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

/* ============================ Chips de tipo (aba Equipamentos e Instrumentos) */
.eqp-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.eqp-chip {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
}
.eqp-chip b { color: var(--text); }
.eqp-chip.is-on { background: #eef7f2; border-color: #16a34a; color: #116632; }
.eqp-chip.is-on b { color: #116632; }

/* ============================ Tour de boas-vindas (primeiro login) */
.tour-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.45);
}
.tour-ring {
  position: fixed; z-index: 61; pointer-events: none;
  border: 3px solid #16a34a; border-radius: 12px;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.25);
  transition: top .25s, left .25s, width .25s, height .25s;
}
.tour-tip {
  position: fixed; z-index: 62;
  background: #fff; border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 18px 50px rgba(15, 42, 30, 0.35);
}
.tour-step { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #16a34a; }
.tour-tip h4 { margin: 4px 0 6px; font-size: 16px; color: #1c2733; }
.tour-tip p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #46525c; }
.tour-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }

/* ============================ Dialogo padrao (substitui alert/confirm/prompt) */
.ui-dlg {
  max-width: 440px;
  width: calc(100% - 40px);
  border: none;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(15, 42, 30, 0.25);
}
.ui-dlg::backdrop { background: rgba(15, 23, 42, 0.42); }
.ui-dlg h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.ui-dlg-msg { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.ui-dlg input {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
}
.ui-dlg menu { display: flex; justify-content: flex-end; gap: 10px; margin: 18px 0 0; padding: 0; }

/* ---- Histórico de alterações (trilha de auditoria por registro) ---- */
.hist-dlg { max-width: 560px; }
.hist-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hist-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fbfdfc;
}
.hist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hist-head strong { font-size: 14.5px; color: var(--text); }
.hist-when { font-size: 12.5px; color: #5f6b7a; white-space: nowrap; }
.hist-who { font-size: 13px; color: #475569; margin-top: 2px; }
.hist-who strong { color: var(--text); }
.hist-diff { margin: 8px 0 0; padding-left: 18px; }
.hist-diff li { font-size: 13.5px; line-height: 1.5; color: var(--text); }
.hist-reason {
  margin-top: 8px;
  font-size: 13px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 7px;
  padding: 6px 9px;
}

/* ---- Caixa de Sugestões — feed estilo rede social ---- */
.sug-av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; line-height: 1;
}
.sug-segbar { display: inline-flex; background: #f1f5f9; border-radius: 999px; padding: 3px; gap: 2px; }
.sug-seg {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; color: #5f6b7a; padding: 5px 14px; border-radius: 999px;
}
.sug-seg.on { background: #fff; color: #0a8055; box-shadow: 0 1px 2px rgba(15,42,30,.12); }
.sug-composer {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 12px;
  max-width: 640px; width: 100%; margin: 0 auto;
}
.sug-composer-input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 999px; padding: 9px 15px;
  color: #8a97a6; font-size: 14px;
}
.sug-composer:hover .sug-composer-input { border-color: #cbd5e1; }
.sug-feed { display: flex; flex-direction: column; gap: 14px; max-width: 640px; width: 100%; margin: 0 auto; }
.sug-post {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 15px 17px;
  display: flex; flex-direction: column; gap: 9px;
}
.sug-post-head { display: flex; align-items: center; gap: 11px; }
.sug-post-who { flex: 1; min-width: 0; }
.sug-post-name { margin: 0; font-size: 14px; font-weight: 700; color: #1f2937; }
.sug-post-meta { margin: 0; font-size: 12px; color: #8a97a6; }
.sug-chip { border-radius: 999px; padding: 3px 11px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.sug-post-title { margin: 0; font-size: 14.5px; font-weight: 700; color: #1f2937; }
.sug-post-body { margin: 0; font-size: 14px; line-height: 1.55; color: #334155; white-space: pre-wrap; }
.sug-response {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 9px;
  padding: 8px 11px; font-size: 12.5px; color: #166534;
}
.sug-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid #f1f5f9; padding-top: 9px; margin-top: 2px;
}
.sug-act {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid #e2e8f0; background: #fff; border-radius: 999px;
  padding: 6px 13px; font-size: 13px; font-weight: 600; color: #475569; font-family: inherit;
}
.sug-act:hover { background: #f8fafc; border-color: #cbd5e1; }
.sug-act.on { background: #ecfdf5; border-color: #a7f3d0; color: #0f7a4d; }
.sug-mine { font-size: 11.5px; color: #8a97a6; }
.sug-cmts { display: flex; flex-direction: column; gap: 5px; padding-left: 2px; }
.sug-cmt { margin: 0; font-size: 13px; line-height: 1.5; color: #475569; }
.sug-cmt strong { color: #1f2937; font-weight: 700; }
.sug-cmt-more { margin: 2px 0 0; font-size: 12.5px; color: #8a97a6; cursor: pointer; }
.sug-cmt-more:hover { color: #0a8055; }

/* ---- Consultas / Enquetes — opções estilo enquete social ---- */
.poll-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.poll-opt {
  position: relative; overflow: hidden; text-align: left; cursor: pointer; font-family: inherit;
  border: 1px solid #e2e8f0; background: #fff; border-radius: 10px; padding: 10px 13px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #334155; width: 100%;
}
.poll-opt:hover:not([disabled]) { border-color: #cbd5e1; }
.poll-opt[disabled] { cursor: default; }
.poll-opt-fill { position: absolute; top: 0; bottom: 0; left: 0; background: #eef2f7; z-index: 0; transition: width .25s ease; }
.poll-opt.chosen { border-color: #a7f3d0; }
.poll-opt.chosen .poll-opt-fill { background: #d1fae5; }
.poll-opt-label { position: relative; z-index: 1; flex: 1; font-weight: 600; }
.poll-opt.chosen .poll-opt-label { color: #0f7a4d; }
.poll-opt-pct { position: relative; z-index: 1; font-weight: 700; color: #475569; white-space: nowrap; }
.poll-vote { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.poll-vote-btn {
  cursor: pointer; font-family: inherit; border: 1px solid #cbd5e1; background: #fff;
  border-radius: 999px; padding: 8px 15px; font-size: 13.5px; font-weight: 600; color: #334155;
}
.poll-vote-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.poll-meta { margin: 2px 0 0; font-size: 12px; color: #8a97a6; }

/* ============================ Acessibilidade (avaliacao UX item 2) */
/* Skip-link: invisivel ate receber foco por teclado (Tab logo ao carregar) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: #0f7a4d;
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 0 0 10px 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* Foco visivel consistente para navegacao por teclado (nao afeta clique do
   mouse — :focus-visible). !important para vencer as camadas do theme-pro. */
:focus-visible {
  outline: 2px solid #0f7a4d !important;
  outline-offset: 2px !important;
}

/* Usuarios com sensibilidade a movimento (ou economia): desliga animacoes */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================ Farol anual de indicadores */
.qif-box { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 14px 16px; margin-bottom: 16px; }
.qif-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.qif-head h3 { margin: 0; font-size: 16px; }
.qif-nav { display: flex; gap: 6px; }
.qif-legend { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.qif-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; }
.qif-dot.qif-dentro { background: #dcf5e6; border: 1px solid #16a34a; }
.qif-dot.qif-fora { background: #fde0e0; border: 1px solid #dc2626; }
.qif-dot.qif-info { background: #e8f0fe; border: 1px solid #2563eb; }
.qif-dot.qif-empty { background: #f1f5f9; border: 1px solid #cbd5e1; }
.qif-scroll { overflow-x: auto; }
.qif-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.qif-table thead th { text-align: center; font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.qif-table thead th:first-child { text-align: left; }
.qif-name { text-align: left; font-weight: 600; color: var(--text); padding: 6px 8px 6px 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid #f1f5f9; }
.qif-cell { text-align: center; padding: 6px 4px; border-bottom: 1px solid #f1f5f9; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 52px; }
.qif-cell.qif-dentro { background: #eefaf2; color: #116632; font-weight: 600; }
.qif-cell.qif-fora { background: #fdeeee; color: #b91c1c; font-weight: 700; }
.qif-cell.qif-info { background: #f0f6fe; color: #1d4ed8; }
.qif-cell.qif-empty { color: #cbd5e1; }

.linked-evidence div {
  display: grid;
  gap: 4px;
}

.linked-evidence a {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}

.empty-state {
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.empty-state span {
  display: block;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .cards,
  .split,
  .palc-evidence-summary {
    grid-template-columns: 1fr 1fr;
  }

  .inline-form {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .filters,
  .section-head,
  .records-toolbar,
  .assistant-box,
  .inline-form,
  .link-evidence-form,
  .status-editor,
  .norm-detail-head,
  .linked-evidence,
  .attachment-row {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .cards,
  .split,
  .form-grid,
  .compact-cards,
  .palc-evidence-summary {
    grid-template-columns: 1fr;
  }

  nav {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 260px),
    var(--bg);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
.button-link {
  border-radius: 7px;
}

button {
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.16);
}

button:hover {
  transform: translateY(-1px);
}

button.secondary,
.button-link {
  background: var(--surface);
  border-color: #cbd5e1;
}

input,
select,
textarea {
  border-color: #cbd5e1;
  border-radius: 7px;
  min-height: 40px;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px var(--focus);
}

.sidebar {
  background: rgba(255, 255, 255, 0.98);
  padding: 18px 14px;
}

.brand-mark {
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.menu-group-title {
  margin-top: 4px;
}

nav button {
  border-left: 3px solid transparent;
}

nav button.active {
  background: var(--green-soft);
  border-left-color: var(--green);
}

.app-shell {
  padding: 28px 34px;
}

.topbar {
  align-items: flex-start;
}

.topbar h1 {
  line-height: 1.1;
}

.filters,
.records-toolbar,
.daily-progress,
.attention-panel,
.dashboard-group .cards,
.split section,
.table-wrap,
.answer,
dialog {
  border-color: #e2e8f0;
}

.attention-panel,
.records-toolbar,
.daily-progress,
.table-wrap,
.split section,
.answer {
  box-shadow: var(--shadow-sm);
}

.card,
.split section,
.answer,
dialog,
.table-wrap,
.records-toolbar,
.daily-progress,
.attention-panel,
.evidence-group,
.attachment-row,
.search-result-card {
  border-radius: 8px;
}

.card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  min-height: 112px;
}

.card strong {
  line-height: 1;
}

.attention-item {
  align-items: center;
  min-height: 42px;
}

th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
}

td {
  color: #0f172a;
}

tbody tr:hover {
  background: #f8fafc;
}

.row-actions {
  gap: 6px;
}

.status {
  border: 1px solid transparent;
}

.status.warn {
  border-color: #f3d38e;
}

.status.danger {
  border-color: #fecaca;
}

.status.success {
  border-color: #dbeafe;
}

.toast {
  border-radius: 8px;
}

.topbar {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  padding: 14px 16px;
}

.topbar .eyebrow {
  margin-top: 0;
}

.topbar h1 {
  font-size: 26px;
}

.top-actions {
  align-items: center;
}

.user-badge {
  border: 1px solid #dbeafe;
}

.sidebar {
  border-right-color: #e2e8f0;
}

.sidebar .brand {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.menu-group {
  margin-top: 12px;
}

.menu-group-title {
  padding: 8px 10px 5px;
}

.menu-group-title span {
  color: #64748b;
  font-size: 10px;
}

nav button {
  min-height: 36px;
  padding: 8px 10px;
}

nav button:hover {
  background: #f1f5f9;
}

nav button.active {
  box-shadow: inset 0 0 0 1px #dbeafe;
}

.table-wrap {
  border-radius: 8px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 10px 12px;
}

tbody tr:nth-child(even):not(.missing-action-plan):not(.equipment-group-start) td {
  background: #ffffff;
}

th {
  border-bottom: 1px solid #cbd5e1;
  letter-spacing: 0;
}

td {
  line-height: 1.25;
}

.row-actions {
  min-width: 170px;
}

button.small {
  min-height: 30px;
  padding: 6px 9px;
}

body {
  background: #f6f8fb;
  color: var(--ink);
}

.sidebar {
  background: var(--surface-panel);
  border-right: 1px solid var(--border-ui);
  box-shadow: none;
}

.sidebar .brand {
  background: var(--surface-panel);
  border-color: var(--border-muted);
  box-shadow: none;
}

.brand-mark {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 10px;
  box-shadow: none;
}

.menu-group-title span {
  color: #697586;
  font-weight: 800;
}

nav button {
  color: #263241;
  font-size: 14px;
  font-weight: 600;
}

nav button.active {
  background: var(--nav-active-bg);
  border-left-color: var(--green);
  color: var(--green-dark);
  box-shadow: none;
}

nav button:hover {
  background: var(--nav-hover-bg);
  color: #111827;
}

.app-shell {
  padding: 22px 28px;
}

.topbar {
  background: var(--surface-panel);
  border-color: var(--border-ui);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.topbar h1 {
  color: #111827;
  font-size: 25px;
  font-weight: 800;
}

.eyebrow {
  color: #697586;
  font-size: 11px;
  font-weight: 700;
}

.filters,
.records-toolbar,
.daily-progress,
.attention-panel,
.table-wrap,
.split section,
.answer,
.card,
dialog {
  background: var(--surface-panel);
  border: 1px solid var(--border-ui);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.filters {
  margin: 14px 0 16px;
  padding: 10px;
}

input,
select,
textarea {
  background: var(--surface-panel);
  border-color: var(--border-control);
  color: #111827;
}

button {
  background: #2563eb;
  border: 1px solid #2563eb;
  box-shadow: none;
}

button.secondary,
.button-link {
  background: var(--surface-panel);
  border-color: var(--border-control);
  color: #1d4ed8;
}

button:hover,
.button-link:hover {
  box-shadow: 0 2px 8px rgba(31, 41, 51, 0.08);
}

.user-badge {
  background: #eff6ff;
  border-color: #dbeafe;
}

.attention-panel {
  padding: 12px 14px;
}

.attention-item {
  background: var(--attention-bg);
  border-color: var(--attention-border);
  border-radius: 8px;
}

.attention-item.danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.card {
  background: var(--surface-panel);
  min-height: 100px;
  padding: 16px;
}

.card strong {
  color: #111827;
  font-size: 28px;
}

.card span {
  color: #697586;
}

.dashboard-group h2 {
  color: #526071;
  font-size: 12px;
  letter-spacing: 0;
}

.table-wrap {
  overflow: auto;
}

th {
  background: #f8fafc;
  color: #526071;
  font-size: 11px;
  font-weight: 800;
}

td {
  border-bottom-color: var(--row-border);
}

tbody tr:nth-child(even):not(.missing-action-plan):not(.equipment-group-start) td {
  background: #fbfcfe;
}

tbody tr:hover td {
  background: var(--row-hover);
}

.status {
  border-radius: 999px;
  font-size: 11px;
}

.search-result-card {
  border-color: var(--border-ui);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.search-summary {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  color: #243746;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-module-chip {
  border-radius: 999px;
  border-width: 1px;
  border-style: solid;
  font-size: 12px;
  padding: 4px 10px;
}

.search-group {
  margin-bottom: 20px;
}

.search-group-title {
  align-items: center;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  margin-bottom: 8px;
}

.search-group-count {
  color: #7a8a99;
  font-size: 12px;
  font-weight: 400;
}

.search-best-match {
  background: #fff6df;
  border: 1px solid #f3c66b;
  border-radius: 999px;
  color: #8a5a00;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  padding: 4px 8px;
}

.search-module-quality {
  background: #e8f4ee;
  border-color: #dbeafe;
}

.search-module-docs {
  background: #eaf2ff;
  border-color: #c9dcfa;
  color: #1d4f91;
}

.search-module-equipment {
  background: #fff7e8;
  border-color: #f0d19a;
  color: #7a4d00;
}

.search-module-risk {
  background: #fff0f0;
  border-color: #f5c4c4;
  color: #9b1c1c;
}

.search-empty {
  background: #ffffff;
  border: 1px dashed #cbd5df;
  border-radius: 10px;
  color: #243746;
  padding: 16px;
}

.search-empty p {
  color: #526371;
  margin: 8px 0 12px;
}

.search-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar {
  padding: 14px 12px;
}

.sidebar .brand {
  margin-bottom: 8px;
}

.menu-group {
  border-top: 1px solid #e6edf3;
  gap: 1px;
  padding-top: 8px;
}

.menu-group-title {
  border: 0;
  min-height: 28px;
  padding: 4px 8px;
}

nav button {
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 6px;
  min-height: 32px;
  padding: 7px 9px;
}

nav button.active {
  background: #e8f4ee;
  box-shadow: none;
}

.dashboard-groups {
  gap: 14px;
}

.dashboard-group {
  display: grid;
  gap: 8px;
}

.dashboard-group h2 {
  border-left: 3px solid var(--green);
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  padding-left: 8px;
  text-transform: uppercase;
}

.dashboard-group .cards {
  gap: 10px;
  /* Garantir altura uniforme entre cards do mesmo grupo */
  align-items: stretch;
}

.dashboard-details {
  background: #fff;
  border: 1px solid #dbe7ef;
  border-radius: 8px;
  padding: 10px 12px;
}

.dashboard-details summary {
  color: #166534;
  cursor: pointer;
  font-weight: 800;
}

.dashboard-details[open] summary {
  margin-bottom: 12px;
}

.attention-panel {
  align-items: center;
  min-height: 56px;
}

.dashboard-priority {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe7ef;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  padding: 14px 16px;
}

.dashboard-priority h2 {
  font-size: 18px;
  margin: 2px 0 4px;
}

.dashboard-priority p {
  color: #697586;
  font-size: 13px;
  margin: 0;
}

.dashboard-priority.ok {
  border-left-color: #22c55e;
}

.dashboard-priority-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.attention-panel h2 {
  font-size: 18px;
}

.attention-list {
  gap: 6px;
}

.attention-item {
  background: #ffffff;
  border-color: #f3c27c;
  color: #344054;
  min-height: 36px;
  padding: 7px 10px;
}

.attention-item strong {
  color: #b54708;
}

.attention-item.danger,
.card.danger {
  background: #fff5f6;
  border-color: #fda4af;
}

.card {
  min-height: 90px;
  padding: 14px;
}

.card strong {
  font-size: 26px;
  margin-top: 8px;
}

.card.warn {
  background: #fffbf3;
  border-color: #f4bd70;
}

.card.muted-card {
  background: #ffffff;
  border-color: #e4eaf0;
}

.filters {
  gap: 8px;
}

.filters select,
.filters input {
  min-height: 38px;
}

.dashboard-group .cards {
  align-items: stretch;
}

.dashboard-card {
  display: grid;
  gap: 10px;
  grid-template-rows: 1fr auto;
  min-height: 104px;
  padding: 16px;
}

.dashboard-card span {
  align-self: start;
  color: #697586;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.dashboard-card strong {
  align-self: end;
  color: #111827;
  font-size: 28px;
  line-height: 1;
  margin: 0;
}

.dashboard-card.warn strong {
  color: var(--amber);
}

.dashboard-card.danger strong {
  color: var(--red);
}

.dashboard-card.muted-card {
  background: #ffffff;
  border-color: var(--border-muted);
  box-shadow: var(--shadow-sm);
}

.dashboard-card.muted-card span,
.dashboard-card.muted-card strong {
  color: #8a95a3;
}

.dashboard-card.muted-card strong {
  font-size: 24px;
  font-weight: 700;
}

#recordDialog {
  max-height: min(86vh, 760px);
  padding: 0;
}

#recordForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(86vh, 760px);
}

#recordDialog h2 {
  background: var(--surface-panel, #ffffff);
  border-bottom: 1px solid var(--border-ui, var(--line));
  margin: 0;
  padding: 18px 20px 12px;
}

#recordDialog .form-grid {
  margin: 0;
  max-height: calc(min(86vh, 760px) - 132px);
  overflow: auto;
  padding: 16px 20px;
}

/* Títulos de seção ficam visíveis enquanto o usuário rola o formulário */
#recordDialog .form-section-title {
  background: var(--surface-panel, #fff);
  position: sticky;
  top: -16px; /* compensa o padding-top do form-grid */
  z-index: 1;
}

#recordDialog menu {
  background: var(--surface-panel, #ffffff);
  border-top: 1px solid var(--border-ui, var(--line));
  margin: 0;
  padding: 12px 20px 16px;
}

@media print {
  .sidebar,
  .topbar,
  .filters,
  .section-head button {
    display: none;
  }

  body {
    display: block;
    background: white;
  }

  .app-shell {
    padding: 0;
  }

  .view:not(.active) {
    display: none;
  }

  .card {
    break-inside: avoid;
  }
}

/* ── Inventory balance table ─────────────────────────────────────────────── */

.inventory-balance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.inventory-balance-table th,
.inventory-balance-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e6edf3;
  text-align: left;
}

.inventory-balance-table thead th {
  background: #f3f7fb;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.row-consumed td {
  color: #8fa3b1;
  font-style: italic;
}

/* Validade: data em formato BR + selo colorido de status (dias restantes) */
.inv-validade {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.inv-validade-date {
  font-weight: 600;
  color: var(--ink, #14201b);
}
.inv-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Envio de anexos do item de estoque */
.inv-attach-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.inv-attach-upload .dropzone { flex: 1 1 220px; margin: 0; }

/* Relatórios de estoque (Inventário / Pedido de compra) */
.inv-reports-dialog { width: min(860px, 96vw); max-width: 96vw; }
.inv-reports-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.inv-reports-tabs { display: flex; gap: 6px; }
.inv-reports-tabs .is-active {
  background: var(--green, #16a34a);
  color: #fff;
  border-color: var(--green, #16a34a);
}
.inv-report-body {
  max-height: 60vh;
  overflow: auto;
  margin-top: 8px;
}
.inv-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.inv-report-table th,
.inv-report-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e6edf3;
  text-align: left;
}
.inv-report-table thead th { background: #f3f7fb; font-weight: 600; position: sticky; top: 0; }
.inv-min-input {
  width: 88px;
  padding: 4px 8px;
  border: 1px solid var(--border-control, #cbd5cf);
  border-radius: 6px;
}
.inv-report-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted, #55636b);
}
.inv-report-table tr.inv-below td {
  background: #fdecea;
}
.inv-count-cell {
  min-width: 120px;
  border-bottom: 1px solid #cbd5cf !important;
}

/* Auditorias — painel de ações & eficácia (ciclo PDCA) */
.audit-actions-dialog { width: min(920px, 96vw); max-width: 96vw; }
.audit-actions-body { max-height: 62vh; overflow: auto; }
.audit-actions-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.audit-actions-table td { vertical-align: top; }
.audit-eff-editor { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.audit-eff-editor textarea {
  width: 100%;
  border: 1px solid var(--border-control, #cbd5cf);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  resize: vertical;
}
.audit-eff-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Programa anual de auditorias (cronograma) */
.audit-program-dialog { width: min(1000px, 97vw); max-width: 97vw; }
.audit-program-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.audit-program-nav { display: flex; align-items: center; gap: 10px; }
.audit-program-nav strong { font-size: 1.1rem; min-width: 54px; text-align: center; }
.audit-program-body { margin-top: 8px; }
.audit-prog-scroll { overflow-x: auto; }
.audit-prog-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.audit-prog-table th, .audit-prog-table td { border: 1px solid #e6edf3; padding: 5px 6px; text-align: center; min-width: 46px; }
.audit-prog-table thead th { background: #f3f7fb; position: sticky; top: 0; }
.audit-prog-sector { text-align: left !important; font-weight: 600; white-space: nowrap; background: #fafcfe; }
.audit-prog-chip { border: none; cursor: pointer; margin: 1px; font-size: 0.72rem; padding: 3px 7px; }

/* Assinatura do relatório de auditoria */
.audit-sign-dialog { width: min(680px, 96vw); max-width: 96vw; }
.audit-sign-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.audit-sign-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line, #e6edf3); border-radius: 8px; padding: 8px 12px; }
.audit-sign-row small { display: block; color: var(--muted, #55636b); }
.audit-sign-thumb { height: 42px; max-width: 180px; object-fit: contain; }
.audit-sign-pad-area { border-top: 1px solid var(--line, #e6edf3); padding-top: 12px; }

/* Painel Segurança & Conformidade */
.security-body { display: flex; flex-direction: column; gap: 18px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.sec-sub { margin: 4px 0 0; color: var(--muted, #55636b); font-size: 0.85rem; }
.sec-score { text-align: center; border-radius: 14px; padding: 10px 18px; min-width: 120px; }
.sec-score.success { background: #e4f1ec; color: var(--success, #16794a); }
.sec-score.warn { background: #f7eedd; color: var(--amber, #b7791f); }
.sec-score.danger { background: #f9e7e4; color: var(--red, #c0392b); }
.sec-score-num { display: block; font-size: 2rem; font-weight: 800; line-height: 1; }
.sec-score-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.sec-section { background: var(--surface, #fff); border: 1px solid var(--line, #e6edf3); border-radius: 14px; padding: 16px 18px; }
.sec-section h3 { margin: 0 0 12px; font-size: 1rem; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sec-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #e6edf3); }
.sec-item.ok { background: #f2faf6; }
.sec-item.off { background: #fdf4ec; }
.sec-item-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: 0 0 auto; }
.sec-item.ok .sec-item-icon { background: var(--success, #16a34a); }
.sec-item.off .sec-item-icon { background: var(--amber, #d97706); }
.sec-item strong { display: block; font-size: 0.9rem; }
.sec-item small { color: var(--muted, #55636b); font-size: 0.78rem; }
.sec-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.sec-card { display: flex; flex-direction: column; gap: 6px; }
.sec-big { margin: 0; font-size: 1.8rem; font-weight: 800; }
.sec-big small { font-size: 0.8rem; font-weight: 500; color: var(--muted, #55636b); }
.sec-list { list-style: none; margin: 4px 0; padding: 0; }
.sec-list li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line, #eef2f6); padding: 4px 0; font-size: 0.86rem; }
.sec-note { margin: 2px 0; font-size: 0.82rem; color: var(--muted, #55636b); }
.sec-note.warn { color: var(--amber, #b7791f); font-weight: 600; }
.sec-card button { margin-top: auto; align-self: flex-start; }
.sec-trail-wrap { overflow-x: auto; }
.sec-trail-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sec-trail-table th, .sec-trail-table td { border-bottom: 1px solid #eef2f6; padding: 6px 8px; text-align: left; white-space: nowrap; }
.sec-trail-table thead th { background: #f3f7fb; position: sticky; top: 0; }
.sec-trail-table td:last-child { white-space: normal; }
/* LGPD — acessos a dados sensíveis */
.daccess-kpis .daccess-kpi.warn .sec-big { color: #b45309; }
.daccess-ext td { background: #fff8ec; }
.daccess-ext td:first-child { box-shadow: inset 3px 0 0 #e0a340; }
.sec-doc-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.sec-doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line, #e6edf3); border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; }
.sec-doc-info strong { display: block; font-size: 0.92rem; }
.sec-doc-info small { color: var(--muted, #55636b); font-size: 0.78rem; }
.sec-doc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec-doc-replace { cursor: pointer; }
.sec-doc-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px dashed var(--line, #e6edf3); padding-top: 12px; }
.sec-doc-upload input[type="text"] { flex: 1 1 260px; padding: 6px 10px; border: 1px solid var(--border-control, #cbd5cf); border-radius: 8px; font: inherit; }

/* Assistente do colaborador — conversa */
.asst-turn { margin-bottom: 16px; }
.asst-q {
  display: inline-block; max-width: 85%; margin: 0 0 8px auto;
  background: var(--green, #16a34a); color: #fff;
  padding: 8px 14px; border-radius: 14px 14px 4px 14px; font-size: 0.9rem;
  float: right; clear: both;
}
.asst-a {
  clear: both; background: var(--surface, #fff); border: 1px solid var(--line, #e6edf3);
  border-radius: 4px 14px 14px 14px; padding: 12px 16px;
}
.asst-answer-text { margin: 0 0 8px; font-size: 0.98rem; color: var(--ink, #14201b); }
.asst-items { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.asst-item {
  padding: 8px 12px; border-radius: 8px; border-left: 4px solid var(--line, #cbd5cf);
  background: #f7f9fb;
}
.asst-item strong { display: block; font-size: 0.9rem; }
.asst-item small { color: var(--muted, #55636b); font-size: 0.8rem; }
.asst-item.asst-danger { border-left-color: var(--red, #c0392b); background: #fcf1ef; }
.asst-item.asst-warn { border-left-color: var(--amber, #d97706); background: #fdf6ec; }
.asst-item.asst-success { border-left-color: var(--success, #16a34a); background: #f2faf6; }
.asst-item.asst-info { border-left-color: #2a6cb0; background: #eef4fb; }
.asst-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.lot-balance-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: #1d4ed8;
  font-weight: 600;
  padding: 2px 8px;
  background: #e8f9ee;
  border-radius: 6px;
}

.history-body {
  min-width: 480px;
  max-height: 60vh;
  overflow-y: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.history-table th,
.history-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #e6edf3;
  text-align: left;
}

.history-table thead th {
  background: #f3f7fb;
  font-weight: 600;
}

.badge-entrada {
  background: #e8f9ee;
  color: #1d4ed8;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-saida {
  background: #ffeaea;
  color: #9b1c1c;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 0.8rem;
  font-weight: 600;
}

.form-error {
  color: #9b1c1c;
  background: #ffeaea;
  border: 1px solid #f5c4c4;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.88rem;
  margin-top: 4px;
}

/* ── Admin buttons in sidebar ────────────────────────────────────────────── */

.menu-divider {
  border: none;
  border-top: 1px solid #e6edf3;
  margin: 6px 0;
}

.menu-admin-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #243746;
  cursor: pointer;
  margin-top: 2px;
}

.menu-admin-btn:hover {
  background: #f3f7fb;
}

.menu-admin-btn.warn {
  color: #7a4d00;
  border-color: #f0d19a;
  background: #fff7e8;
}

.menu-admin-btn.warn:hover {
  background: #ffeec8;
}

.inventory-alert-banner {
  background: #fff3cd;
  border: 1px solid #f0c36d;
  border-left: 4px solid #e07b00;
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #5a3e00;
}

/* ── Quality Indicators Panel ──────────────────────────────────────────────── */
.qi-view { padding: 0 24px 32px; }
.qi-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.qi-header h2 { margin: 0; }
.qi-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qi-alert-banner { background: #fff3cd; border: 1px solid #f0c36d; border-left: 4px solid #e07b00; border-radius: 6px; padding: 10px 16px; margin-bottom: 14px; font-size: 0.88rem; color: #5a3e00; }
.qi-summary-cards { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.qi-summary-card { display: grid; grid-template-rows: auto auto auto; gap: 5px; min-height: 96px; text-align: left; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; box-shadow: 0 1px 2px #00000008; cursor: pointer; }
.qi-summary-card:hover { border-color: #5f6b7a; background: #f8fafc; transform: translateY(-1px); }
.qi-summary-card span { color: #1f2937; font-size: 0.86rem; font-weight: 800; line-height: 1.2; }
.qi-summary-card strong { font-size: 2rem; line-height: 1; }
.qi-summary-card small { color: #64748b; font-size: 0.76rem; line-height: 1.25; }
.qi-summary-card.danger { border-left: 4px solid #ef4444; }
.qi-summary-card.warning { border-left: 4px solid #f59e0b; }
.qi-summary-card.success { border-left: 4px solid #22c55e; }
.qi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; margin-bottom: 28px; }
.qi-card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 16px; cursor: pointer; transition: box-shadow 0.15s; display: flex; flex-direction: column; }
.qi-card:hover { box-shadow: 0 8px 24px #0002; }
.qi-card.dentro { border-left: 5px solid #22c55e; }
.qi-card.fora { border-left: 5px solid #ef4444; }
.qi-card.sem_meta { border-left: 5px solid #5f6b7a; }
.qi-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.qi-card-name { font-weight: 700; font-size: 1.05rem; margin: 0; }
.qi-card-status-line { font-size: 0.8rem; color: #64748b; margin-top: 3px; }
.qi-card-data { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.qi-card-value-block { display: flex; align-items: baseline; gap: 8px; }
.qi-card-value { font-size: 1.8rem; font-weight: 700; margin: 0; }
.qi-card-value.dentro { color: #16a34a; }
.qi-card-value.fora { color: #dc2626; }
.qi-card-trend { font-size: 0.9rem; font-weight: 600; }
.qi-card-meta { font-size: 0.8rem; color: #64748b; white-space: nowrap; }
.qi-card-mini-chart { margin-bottom: 12px; height: 60px; }
.qi-card-no-data { font-size: 0.82rem; color: #5f6b7a; padding: 8px 0; }
.qi-card-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.qi-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; margin-bottom: 28px; }
.qi-chart-wrap { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 18px; }
.qi-chart-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.qi-chart-canvas { width: 100%; max-height: 220px; }
.qi-history-section { margin-top: 20px; }
.qi-history-section h3 { margin-bottom: 10px; }
.qi-detail-body { max-height: 60vh; overflow-y: auto; }
.qi-detail-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.87rem; }
.qi-detail-row strong { min-width: 140px; color: #475569; }
.qi-calc-preview { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 8px 12px; font-size: 0.85rem; color: #116632; width: 100%; box-sizing: border-box; }
.qi-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.qi-card-value-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.qi-card-trend { font-size: 0.85rem; font-weight: 600; }
.qi-badge { display: inline-block; padding: 4px 10px; border-radius: 14px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.qi-badge.dentro { background: #dcfce7; color: #116632; }
.qi-badge.fora { background: #fee2e2; color: #dc2626; }
.qi-badge.sem_meta { background: #f1f5f9; color: #64748b; }
.qi-badge.danger { background: #fee2e2; color: #dc2626; }
.qi-badge.warning { background: #fef3c7; color: #b45309; }
.qi-inactive { opacity: 0.5; }
.qi-bulk-list { display: grid; gap: 12px; margin-bottom: 14px; max-height: 60vh; overflow-y: auto; }
.qi-bulk-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; }
.qi-bulk-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qi-bulk-header label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
.qi-bulk-check { cursor: pointer; }
.qi-bulk-fields { display: flex; gap: 8px; }
.qi-bulk-value, .qi-bulk-denom, .qi-bulk-critical { flex: 1; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.9rem; }
.qi-bulk-value:focus, .qi-bulk-denom:focus, .qi-bulk-critical:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f606; }
.qi-card-history { margin-top: 12px; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.qi-history-list { display: flex; flex-direction: column; gap: 8px; }
.qi-history-entry { background: #f8fafc; border-left: 3px solid #3b82f6; padding: 10px; border-radius: 4px; }
.qi-history-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; gap: 6px; }
.qi-history-period { color: #64748b; min-width: 70px; }
.qi-history-status { color: #475569; }
.qi-history-value { color: #0f172a; font-weight: 700; }
.qi-history-analysis { font-size: 0.75rem; color: #475569; line-height: 1.4; }
.qi-history-empty { font-size: 0.8rem; color: #5f6b7a; text-align: center; padding: 8px; }

@media (max-width: 980px) {
  .qi-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .qi-summary-cards,
  .qi-cards { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .dashboard-priority {
    grid-template-columns: 1fr;
  }

  .dashboard-priority-list {
    justify-content: flex-start;
  }
}

.backup-info {
  font-size: 0.82rem;
  color: #556;
  background: #f5f7fa;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 10px;
}

.trainings-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.trainings-matrix-table th,
.trainings-matrix-table td {
  padding: 10px 8px;
  border: 1px solid #e6edf3;
  text-align: center;
}

.trainings-matrix-table thead th {
  background: #f3f7fb;
  font-weight: 600;
  color: #1f2933;
}

.trainings-matrix-table tbody tr:hover {
  background: #f9fbfd;
}

.tm-user-cell {
  text-align: left;
  font-weight: 500;
  background: #f8fafc;
}

.tm-cell {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tm-completed {
  background: #dcfce7;
  color: #116632;
  font-weight: 600;
}

.tm-pending {
  background: #fef3c7;
  color: #92400e;
}

.tm-date {
  font-size: 0.75rem;
}

.bulk-users-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}

.bulk-users-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 12px;
}

.bulk-user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 4px;
  background: #f8fafc;
  font-size: 0.9rem;
}

.bulk-user-item input {
  cursor: pointer;
}

/* --- Assinatura eletronica / ciencia de documentos --- */
.sign-dialog {
  width: min(920px, 96vw);
  max-width: 96vw;
  /* Ocupa no maximo a altura da viewport e organiza o conteudo em coluna:
     o visualizador do documento e a unica parte que encolhe/rola, de modo que
     o quadro de assinatura e os botoes de acao ficam SEMPRE visiveis. */
  max-height: min(94vh, 94dvh);
  flex-direction: column;
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
}

/* Só vira flex-column quando aberto — senão sobrescreveria o display:none
   nativo do <dialog> fechado e o quadro ficaria visível na página. */
.sign-dialog[open] {
  display: flex;
}

.sign-head,
.sign-gate-hint,
.sign-pad-wrap,
.sign-foot {
  flex: 0 0 auto;
}

.sign-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.sign-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.sign-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sign-viewer {
  flex: 1 1 auto;
  min-height: 140px;
  overflow: auto;
  background: #eef2f6;
  padding: 16px;
  scroll-behavior: smooth;
}

.sign-viewer iframe {
  width: 100%;
  height: 1400px;
  border: 1px solid var(--line);
  background: #fff;
}

.sign-viewer img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #fff;
}

.sign-doc-text {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 26px;
  line-height: 1.6;
  color: var(--ink);
  font-size: 14px;
}

.sign-doc-end {
  margin-top: 18px;
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px dashed var(--border-control);
}

.sign-gate-hint {
  padding: 8px 20px;
  font-size: 12px;
  color: var(--amber);
  background: #fff8ed;
  border-top: 1px solid var(--line);
}

.sign-gate-hint.ready {
  color: var(--green-dark);
  background: var(--green-soft);
}

.sign-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sign-read {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

#signConfirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Painel de assinaturas do gestor */
.sign-panel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.sign-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--border-muted);
  overflow: hidden;
  margin: 6px 0 18px;
}

.sign-progress > div {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Comprovante imprimivel */
.certificate-dialog {
  width: min(720px, 96vw);
  border: none;
  border-radius: 12px;
  padding: 0;
}

.certificate-dialog menu {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.certificate-sheet {
  padding: 32px 36px;
  color: var(--ink);
}

.certificate-sheet h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
  color: var(--green-dark);
}

.certificate-sheet .cert-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}

.certificate-sheet dl {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px 14px;
  margin: 0;
  font-size: 13px;
}

.certificate-sheet dt {
  color: var(--muted);
  font-weight: 600;
}

.certificate-sheet dd {
  margin: 0;
  word-break: break-word;
}

.certificate-sheet .cert-hash {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.certificate-sheet .cert-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

@media print {
  body * { visibility: hidden; }
  #certificateDialog, #certificateDialog * { visibility: visible; }
  #certificateDialog { position: absolute; inset: 0; box-shadow: none; }
  .no-print { display: none !important; }
}

.audit-execution-dialog,
.audit-history-dialog,
.audit-checklist-dialog {
  width: min(980px, calc(100vw - 24px));
  max-width: 980px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
}

.audit-execution-dialog form,
.audit-history-dialog form,
.audit-checklist-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.audit-execution-body,
.audit-history-body,
.audit-checklist-body {
  max-height: 76vh;
  overflow: auto;
}

.audit-exec-shell {
  display: grid;
  gap: 14px;
}

.audit-exec-summary,
.audit-exec-footer,
.audit-history-meta {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.audit-exec-summary span,
.audit-exec-summary small {
  display: block;
  color: var(--muted);
}

.audit-exec-kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.audit-exec-kpis span,
.audit-history-meta article {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.audit-progress-track {
  height: 10px;
  background: var(--border-muted);
  border-radius: 999px;
  overflow: hidden;
}

.audit-progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #3b82f6);
  border-radius: inherit;
}

.audit-question-card,
.audit-history-list,
.audit-history-evidences {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.audit-question-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.audit-question-step {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.audit-question-text {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.6;
}

.audit-answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.audit-answer-btn {
  min-height: 54px;
  font-size: 14px;
}

.audit-answer-btn.active {
  outline: 3px solid var(--focus);
  transform: translateY(-1px);
}

.audit-field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.audit-field small {
  color: var(--muted);
}

.audit-field textarea,
.audit-field select {
  width: 100%;
}

.audit-attachment-bar,
.audit-attachment-list,
.audit-exec-nav,
.audit-exec-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.audit-history-entry,
.audit-history-evidence {
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 12px;
}

.audit-history-entry:first-child,
.audit-history-evidence:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.audit-history-entry span,
.audit-history-entry small {
  display: block;
  color: var(--muted);
}

.audit-checklist-toolbar,
.audit-checklist-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.audit-checklist-toolbar label {
  flex: 1 1 360px;
}

.audit-checklist-body textarea {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .audit-answer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .audit-execution-dialog,
  .audit-history-dialog,
  .audit-checklist-dialog {
    width: calc(100vw - 12px);
    max-width: none;
  }

  .audit-execution-dialog form,
  .audit-history-dialog form,
  .audit-checklist-dialog form {
    padding: 14px;
  }

  .audit-exec-footer button,
  .audit-answer-btn,
  .audit-attachment-bar .button-link {
    width: 100%;
    justify-content: center;
  }

  .audit-checklist-actions button,
  .audit-checklist-toolbar button {
    width: 100%;
  }
}

/* ===== Matriz de Responsabilidades: explorador de pastas em cards ===== */
.resp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.resp-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.resp-card:hover,
.resp-card:focus-visible {
  border-color: #0f7a4d;
  box-shadow: 0 2px 10px rgba(15, 122, 77, 0.10);
  outline: none;
}

.resp-card-main {
  border-color: #b7dcc9;
  background: #fbfefc;
}

/* Chevron do grupo gira quando a seção está aberta */
details[data-group-key] > summary::-webkit-details-marker { display: none; }
details[data-group-key][open] .resp-group-chevron { display: inline-block; transform: rotate(90deg); }
details[data-group-key] .resp-group-chevron { display: inline-block; transition: transform 0.12s ease; }
details[data-group-key] > div[data-activity-open]:hover { background: #f8fafc; }
