/* Painel incidentes — alinhado ao tema admin (style.css) */

:root {
  --sp-navy: #172b4d;
  --sp-text: #253858;
  --sp-muted: #5e6c84;
  /* Wake (wake.tech) — roxo primário, ciano como acento */
  --sp-blue: #9b51e0;
  --sp-blue-hover: #8232c8;
  --sp-wake-cyan: #66d9ef;
  --sp-border: #dfe1e6;
  --sp-bg: #ffffff;
  --sp-bg-subtle: #f4f5f7;
  --sp-danger: #de350b;
  --sp-success: #36b37e;
  --sp-warning: #ffab00;
}

.sp-main {
  flex: 1;
  padding: 1.75rem 2.25rem 3rem;
  max-width: 1120px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sp-text);
  background: var(--sp-bg);
  min-width: 0;
}

body.admin-shell .sp-main {
  min-height: 0;
  overflow-y: auto;
}

/* Incidentes: mesmo painel que index.html (classe .main + largura máxima) */
.incidents-admin-main {
  max-width: 1120px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sp-text);
  background: var(--sp-bg);
}

body.admin-shell .incidents-admin-main {
  min-height: 0;
  overflow-y: auto;
}

.incidents-main-head-bar {
  align-items: center;
  margin-bottom: 0.35rem;
}

.incidents-head-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.incidents-page-h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--sp-navy);
  letter-spacing: -0.02em;
}

.sp-incidents-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.sp-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--sp-navy);
  letter-spacing: -0.02em;
}

.sp-search {
  width: 220px;
  max-width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--sp-border);
  border-radius: 4px;
  font: inherit;
  font-size: 0.875rem;
  background: var(--sp-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235E6C84' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
  background-size: 14px;
}

.sp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--sp-border);
  margin-top: 1.25rem;
}

.sp-tab {
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sp-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.sp-tab:hover {
  color: var(--sp-text);
}

.sp-tab.active {
  color: var(--sp-blue);
  border-bottom-color: var(--sp-blue);
}

.sp-tab:focus-visible,
.sp-btn:focus-visible,
.sp-search:focus-visible,
.sp-status-rail-btn:focus-visible {
  outline: 2px solid var(--sp-blue);
  outline-offset: 2px;
}

.sp-panel {
  display: none;
  padding-top: 2rem;
}

.sp-panel.active {
  display: block;
}

.sp-panel-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.sp-btn-primary {
  background: var(--sp-blue);
  color: #fff;
  box-shadow: 0 1px 1px rgba(9, 30, 66, 0.12);
}

.sp-btn-primary:hover {
  background: var(--sp-blue-hover);
}

.sp-btn-secondary {
  background: var(--sp-bg);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
}

.sp-btn-danger {
  background: var(--sp-danger);
  color: #fff;
  border: none;
}
.sp-btn-danger:hover {
  background: #bf2600;
}

.sp-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 480px;
  margin: 0 auto;
}

.sp-empty-visual {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 1rem;
  opacity: 0.85;
}

.sp-empty h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--sp-navy);
}

.sp-empty p {
  margin: 0 0 1.5rem;
  color: var(--sp-muted);
  font-size: 0.9375rem;
}

.sp-form {
  max-width: 640px;
}

.sp-form h2 {
  margin: 0 0 1.25rem;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--sp-navy);
}

.sp-form-row {
  margin-bottom: 1.25rem;
}

.sp-form-row label,
.sp-form-row .sp-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sp-muted);
  margin-bottom: 0.35rem;
}

.sp-form-row .sp-hint {
  font-size: 0.75rem;
  color: var(--sp-muted);
  margin-top: 0.35rem;
}

.sp-hint-inline {
  display: inline;
  margin-top: 0;
  font-weight: 400;
}

.sp-datetime-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sp-input.sp-input-date {
  width: auto;
  min-width: 10rem;
  max-width: 100%;
}

.sp-input.sp-input-time {
  width: auto;
  min-width: 6.5rem;
  max-width: 100%;
}

.sp-duration-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.sp-duration-unit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sp-input.sp-input-duration {
  width: 3.25rem;
  min-width: 3.25rem;
  max-width: 4.5rem;
  flex: 0 0 auto;
  text-align: center;
}

.sp-duration-suffix {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sp-muted);
  white-space: nowrap;
}

.sp-input,
.sp-select,
.sp-textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--sp-border);
  border-radius: 4px;
  font: inherit;
  font-size: 0.875rem;
}

.sp-textarea {
  min-height: 120px;
  resize: vertical;
}

.sp-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sp-border);
}

.sp-link {
  color: var(--sp-blue);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.sp-link:hover {
  text-decoration: underline;
}

/* Links de ação (editar / excluir) — contraste no tema escuro */
html.spm-dark .sp-link {
  color: #93c5fd;
  font-weight: 600;
}

html.spm-dark .sp-link:hover {
  color: #bfdbfe;
}

.sp-form-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Barra de progresso + passos (estilo Statuspage / referência) */
.sp-status-rail {
  margin-top: 0.35rem;
  padding: 0.85rem 1rem 0.75rem;
  border: 1px solid var(--sp-border);
  border-radius: 4px;
  background: var(--sp-bg);
}

.sp-status-rail-track {
  height: 4px;
  background: #dfe1e6;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.sp-status-rail-fill {
  height: 100%;
  width: 25%;
  background: var(--sp-blue);
  border-radius: 2px 0 0 2px;
  transition: width 0.22s ease;
  min-width: 0;
}

.sp-status-rail-fill.sp-fill-end {
  border-radius: 2px;
}

.sp-status-rail-steps {
  display: flex;
  width: 100%;
}

.sp-status-rail-btn {
  flex: 1;
  padding: 0.35rem 0.25rem 0;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--sp-text);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  line-height: 1.3;
}

.sp-status-rail-btn:hover {
  color: var(--sp-blue);
}

.sp-status-rail-btn.active {
  color: var(--sp-blue);
  font-weight: 700;
  border-bottom-color: var(--sp-blue);
}

.sp-status-rail-steps-5 {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.2rem;
  padding-bottom: 0.35rem;
  margin-bottom: -0.15rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.sp-status-rail-steps-5 .sp-status-rail-btn {
  flex: 0 0 auto;
  min-width: 6rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .sp-status-rail-steps-5 {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .sp-status-rail-steps-5 .sp-status-rail-btn {
    flex: 1 1 18%;
    min-width: 5.5rem;
    font-size: 0.72rem;
    white-space: normal;
  }
}

.sp-menu-wrap {
  position: relative;
  display: inline-block;
}
.sp-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.2rem;
  min-width: 10rem;
  background: var(--sp-bg);
  border: 1px solid var(--sp-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(9, 30, 66, 0.15);
  z-index: 50;
  padding: 0.25rem 0;
}
.sp-dropdown.hidden {
  display: none !important;
}
.sp-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.85rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--sp-text);
}
.sp-dropdown-item:hover {
  background: var(--sp-bg-subtle);
}
.sp-dropdown-item.danger {
  color: var(--sp-danger);
  font-weight: 500;
}

.sp-check-grid {
  border-top: 1px solid var(--sp-border);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.sp-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.875rem;
}

.sp-check input {
  width: 1rem;
  height: 1rem;
}

.sp-template-list {
  border: 1px solid var(--sp-border);
  border-radius: 4px;
  background: var(--sp-bg);
}

.sp-template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--sp-border);
  font-size: 0.875rem;
}

.sp-template-row:last-child {
  border-bottom: none;
}

.sp-template-row.sp-group {
  font-weight: 600;
  color: var(--sp-navy);
  background: var(--sp-bg-subtle);
}

.sp-template-row.sp-child {
  padding-left: 2rem;
}

.sp-row-actions {
  display: flex;
  gap: 0.35rem;
}

.sp-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: var(--sp-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.sp-icon-btn:hover {
  color: var(--sp-text);
}

.sp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--sp-border);
  border-radius: 4px;
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sp-table th,
.sp-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--sp-border);
}

.sp-table th {
  background: var(--sp-bg-subtle);
  font-weight: 600;
  color: var(--sp-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sp-table tr:last-child td {
  border-bottom: none;
}

.sp-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
}

.sp-badge-open {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff7d6;
  color: #974f0c;
}
.sp-badge-open::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--sp-warning);
}

.sp-badge-resolved {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #e3fcef;
  color: #006644;
}
.sp-badge-resolved::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--sp-success);
}

.lu-mfa-wrap {
  position: relative;
  display: inline-block;
}

.sp-badge-mfa {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #e8f4fd;
  color: #0055b3;
  border: 1px solid #b3d4f0;
  cursor: pointer;
  white-space: nowrap;
}
.sp-badge-mfa::after {
  content: "▾";
  font-size: 0.65rem;
  opacity: 0.7;
}
.sp-badge-mfa:hover {
  background: #d0e8f9;
}

.sp-msg {
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.sp-msg.error {
  color: #bf2600;
}

.sp-inc-comp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  width: 100%;
  margin-bottom: 0.15rem;
}

.sp-inc-comp-head-title {
  margin: 0;
}

.sp-btn-select-all {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.45rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  color: var(--sp-blue);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.06);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.sp-btn-select-all:hover {
  background: rgba(0, 82, 204, 0.08);
  border-color: rgba(0, 82, 204, 0.45);
  box-shadow: 0 2px 4px rgba(9, 30, 66, 0.08);
}

.sp-btn-select-all:active {
  box-shadow: none;
}

.sp-comp-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sp-btn-bulk {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--sp-border);
  background: var(--sp-bg);
  color: var(--sp-blue);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.06);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.sp-btn-bulk:hover {
  background: rgba(0, 82, 204, 0.08);
  border-color: rgba(0, 82, 204, 0.45);
}

.sp-btn-bulk:active {
  box-shadow: none;
}

.sp-btn-bulk-outline {
  background: transparent;
  color: var(--sp-text);
}

.sp-btn-bulk-outline:hover {
  background: var(--sp-bg-subtle);
  border-color: var(--sp-border);
  color: var(--sp-text);
}

.sp-inc-comp-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sp-inc-comp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--sp-border);
}

.sp-inc-comp-row:last-child {
  border-bottom: none;
}

.sp-inc-comp-check {
  flex: 1 1 200px;
  margin: 0;
  font-weight: 500;
}

.sp-inc-comp-status {
  min-width: 12rem;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* Sidebar ativa: reforço quando layout.incidents usa a mesma classe */
.layout .sidebar .nav-item.active {
  background: rgba(0, 82, 204, 0.1);
  border-left-color: var(--sp-blue);
  color: var(--sp-blue);
  font-weight: 600;
}

/* Tema escuro (classe em <html>, ver theme-apply.js) */
html.spm-dark {
  --sp-navy: #e8edf4;
  --sp-text: #c9d1d9;
  --sp-muted: #94a3b8;
  --sp-border: #334155;
  --sp-bg: #1e293b;
  --sp-bg-subtle: #273549;
}

html.spm-dark .sp-status-rail-track {
  background: #3d4d66;
}

html.spm-dark .sp-dropdown {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

html.spm-dark .sp-badge-open {
  background: rgba(255, 171, 0, 0.18);
  color: #fcd34d;
}

html.spm-dark .sp-badge-resolved {
  background: rgba(54, 179, 126, 0.18);
  color: #6ee7b7;
}

html.spm-dark .sp-msg.error {
  color: #fca5a5;
}

html.spm-dark .sp-btn-select-all:hover,
html.spm-dark .sp-btn-bulk:hover {
  background: rgba(155, 81, 224, 0.12);
  border-color: rgba(155, 81, 224, 0.45);
}

html.spm-dark .sp-btn-bulk-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--sp-border);
}

html.spm-dark .layout .sidebar .nav-item.active {
  background: rgba(155, 81, 224, 0.22);
}

html.spm-dark .sp-input,
html.spm-dark .sp-select,
html.spm-dark .sp-textarea {
  background: var(--sp-bg);
  color: var(--sp-text);
}

.maint-td-actions {
  vertical-align: top;
}

.maint-action-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.maint-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.maint-action-row--status {
  padding-top: 0.15rem;
  border-top: 1px solid var(--sp-border, rgba(0, 0, 0, 0.1));
}
