/**
 * SysPonto — padrão SaaS: tabelas, status, microinterações, skeleton
 */
:root {
  --sp-transition: 0.2s ease;
}

/* ----- Botões & foco ----- */
.sp-btn-icon {
  transition: background-color var(--sp-transition), color var(--sp-transition), transform var(--sp-transition), box-shadow var(--sp-transition);
}
.sp-btn-icon:hover:not(:disabled) {
  transform: translateY(-1px);
}

button.btn,
a.btn {
  transition: background-color var(--sp-transition), border-color var(--sp-transition), color var(--sp-transition), box-shadow var(--sp-transition), transform var(--sp-transition);
}
button.btn:hover:not(:disabled),
a.btn:hover {
  transform: translateY(-1px);
}

/* ----- Toolbar de tabela ----- */
.sp-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.sp-table-toolbar__search {
  flex: 1 1 220px;
  max-width: 320px;
}
.sp-table-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.sp-filter-chip {
  border: 1px solid var(--sp-border, #e5e7eb);
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color var(--sp-transition), border-color var(--sp-transition), color var(--sp-transition);
}
.sp-filter-chip:hover {
  border-color: rgba(249, 115, 22, 0.45);
}
.sp-filter-chip.is-active {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.5);
  color: var(--sp-accent-hover, #ea580c);
  font-weight: 600;
}

/* ----- Tabela ----- */
.sp-table-wrap {
  border: 1px solid var(--sp-border, #e5e7eb);
  border-radius: var(--sp-radius-card, 12px);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--sp-shadow-card, 0 1px 3px rgba(15, 23, 42, 0.06));
}
.sp-table {
  margin-bottom: 0;
  font-size: 0.9rem;
}
.sp-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--sp-text-secondary, #6b7280);
  border-bottom-width: 1px;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
}
.sp-table thead th[data-sp-sort] {
  cursor: pointer;
  transition: background-color var(--sp-transition), color var(--sp-transition);
}
.sp-table thead th[data-sp-sort]:hover {
  background: rgba(17, 24, 39, 0.04);
  color: var(--sp-text, #111827);
}
.sp-table thead th .sp-sort-ind {
  opacity: 0.35;
  font-size: 0.7rem;
  margin-left: 0.2rem;
}
.sp-table thead th.sp-sorted-asc .sp-sort-ind,
.sp-table thead th.sp-sorted-desc .sp-sort-ind {
  opacity: 1;
  color: var(--sp-accent, #f97316);
}
.sp-table tbody tr {
  transition: background-color var(--sp-transition), box-shadow var(--sp-transition);
}
.sp-table tbody tr:hover {
  background: rgba(249, 115, 22, 0.04) !important;
}
.sp-table td {
  vertical-align: middle;
}

/* ----- Status ----- */
.sp-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}
.sp-status--neutral { background: #f3f4f6; color: #374151; }
.sp-status--info { background: #dbeafe; color: #1e40af; }
.sp-status--warning { background: #fef3c7; color: #92400e; }
.sp-status--danger { background: #fee2e2; color: #991b1b; }
.sp-status--success { background: #dcfce7; color: #166534; }

/* ----- Ações inline ----- */
.sp-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.sp-actions-inline .btn {
  transform: none;
}
.sp-actions-inline .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* ----- Loading (form) ----- */
.sp-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.65;
}
.sp-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: inherit;
}

/* ----- Skeleton ----- */
.sp-skeleton {
  background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: sp-skel 1.2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes sp-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sp-skeleton-line { height: 0.85rem; margin-bottom: 0.5rem; }
.sp-skeleton-line:last-child { margin-bottom: 0; }

/* ----- Toast (feedback pós-ação) ----- */
.sp-toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}
.sp-toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15);
  animation: sp-toast-in 0.25s ease;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.sp-toast--ok {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.sp-toast--err {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
@keyframes sp-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Dashboard próximas ações / insights ----- */
.sp-insight-bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 0.35rem;
}
.sp-insight-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f97316, #ea580c);
  transition: width 0.35s ease;
}
.sp-next-action {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--sp-border, #e5e7eb);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--sp-transition), box-shadow var(--sp-transition), background-color var(--sp-transition);
}
.sp-next-action:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: var(--sp-shadow-card, 0 1px 3px rgba(15, 23, 42, 0.06));
  color: inherit;
}
.sp-next-action--high { border-left: 4px solid #dc3545; }
.sp-next-action--med { border-left: 4px solid #fd7e14; }
.sp-next-action--low { border-left: 4px solid #6c757d; }
.sp-next-action--ok { border-left: 4px solid #198754; }

.sp-pattern-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--sp-border, #e5e7eb);
}
.sp-pattern-item:last-child { border-bottom: 0; }
.sp-pattern-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
