/* === UI Global – Listas e Forms (tema branco + OrangeRed) === */
:root{
  --ui-bg: #ffffff;
  --ui-text: #0f172a;          /* slate-900 */
  --ui-muted: #475569;         /* slate-600 */
  --ui-border: #E5E9F0;        /* próximo do slate-200 */
  --ui-border-strong: #D8DEE9;
  --ui-row: #F8FAFC;           /* slate-50 */
  --ui-row-hover: #F1F5F9;     /* slate-100 */
  --ui-ring: rgba(255,69,0,.15);     /* OrangeRed 15% */
  --ui-ring-strong: rgba(255,69,0,.25);

  /* herdamos da sidebar para manter a cor principal */
  --ui-accent: var(--sidebar-accent, #FF4500);
  --ui-accent-600: var(--sidebar-accent-600, #882700);
}

/* ---------- Toolbar (filtros) ---------- */
.toolbar{
  position: sticky; top: 0; z-index: 10;
  display: block;
  background: rgba(255,255,255,.95);
  -webkit-backdrop-filter: saturate(180%) blur(6px);
  backdrop-filter: saturate(180%) blur(6px);
  border: 1px solid var(--ui-border);
  border-radius: .5rem;
  padding: .6rem .75rem;
  margin-bottom: 1rem;
}
.toolbar .row{
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem;
}

/* ---------- Inputs / Selects ---------- */
.input, .select{
  width: 11rem;               /* ~ w-44 */
  height: 2.25rem;            /* ~ h-9 */
  font-size: .875rem;         /* text-sm */
  color: var(--ui-text);
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: .375rem;
  padding: 0 .75rem;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.select{
  padding-right: 2rem;        /* espaço para setinha nativa */
}
.input:focus, .select:focus{
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-ring);
}
.input::placeholder{ color: #94a3b8; } /* slate-400 */

/* variações de largura rápidas */
.w-32 { width: 8rem;  }  /* registros/paginação */
.w-36 { width: 9rem;  }
.w-40 { width: 10rem; }
.w-44 { width: 11rem; }
.w-48 { width: 12rem; }
.w-56 { width: 14rem; }

/* ---------- Botões ---------- */
.btn{
  display: inline-flex;              /* <-- centraliza */
  align-items: center;               /* <-- centraliza */
  justify-content: center;           /* <-- centraliza */
  gap: .4rem;

  height: 2.25rem;
  padding: 0 .75rem;
  font-size: .875rem;
  border-radius: .5rem;
  border: 1px solid var(--ui-border-strong);
  background: #fff;
  color: var(--ui-text);
  cursor: pointer;
  text-decoration: none;             /* para <a> com .btn */
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover{ background: var(--ui-row); }
.btn:focus-visible{ outline: 2px solid var(--ui-accent); outline-offset: 2px; }

/* variantes */
.btn-primary{
  border-color: var(--ui-accent);
  background: var(--ui-accent);
  color: #fff;
}
.btn-primary:hover{
  border-color: var(--ui-accent-600);
  background: var(--ui-accent-600);
}
.btn-ghost{
  border-color: var(--ui-border);
  background: transparent;
}
.btn-ghost:hover{ background: var(--ui-row); }

/* novas – para ações na tabela */
.btn-outline{
  border-color: var(--ui-accent);
  color: var(--ui-accent);
  background: #fff;
}
.btn-outline:hover{ background: var(--ui-accent-050); }

.btn-danger{
  border-color:#ef4444; background:#ef4444; color:#fff;
}
.btn-danger:hover{ border-color:#dc2626; background:#dc2626; }

.btn-success{
  border-color:#16a34a; background:#16a34a; color:#fff;
}
.btn-success:hover{ border-color:#15803d; background:#15803d; }

/* tamanho pequeno para tabela */
.btn-sm{
  height: 1.9rem;
  padding: 0 .6rem;
  font-size: .8rem;
  border-radius: .4rem;
}
/* ---------- Tabela ---------- */
.table{
  width: 100%;
  border: 1px solid var(--ui-border);
  border-collapse: separate;
  border-radius: .5rem;
  overflow: hidden; /* arredonda o cabeçalho */
  font-size: .875rem;
}
.table thead th{
  background: var(--ui-row);
  color: var(--ui-muted);
  text-align: left;
  padding: .5rem .5rem;
  border-bottom: 1px solid var(--ui-border);
  font-weight: 600;
}
.table tbody td{
  padding: .5rem .5rem;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-text);
  white-space: nowrap;
}
.table tbody tr:hover{ background: var(--ui-row-hover); }

/* truncar com elegância */
.truncate{
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Badges (status etc.) ---------- */
.badge{
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; line-height: 1rem;
  border: 1px solid transparent;
}
.badge-green { background: #E6F9ED; color: #166534; border-color: #B7E4C7; }
.badge-red   { background: #FDECEC; color: #991B1B; border-color: #F8C9C9; }

/* ---------- Paginação ---------- */
.pagination{ display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-top: 5px; }
.page-link{
  display:inline-flex; align-items:center; justify-content:center;
  height: 2rem; min-width: 2rem; padding: 0 .5rem;
  border: 1px solid var(--ui-border); border-radius: .5rem;
  color: var(--ui-text); text-decoration: none; background: #fff;
}
.page-link:hover{ background: var(--ui-row); }
.page-link.is-active{
  background: var(--ui-accent); color:#fff; border-color: var(--ui-accent);
}

/* ===== KPI Cards (Dashboard) ===== */
.kpi-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.kpi-card{
  position: relative;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(2,8,23,.05);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.kpi-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(2,8,23,.08);
}
.kpi-card::before{
  content: "";
  position: absolute;
  inset: 0 0 auto 0;   /* top */
  height: 4px;
  background: var(--kpi-color, var(--ui-accent));
  border-radius: 12px 12px 0 0;
}

.kpi-label{
  font-size: .8rem;
  color: #64748b; /* slate-500 */
}
.kpi-value{
  margin-top: 4px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #0f172a; /* slate-900 */
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
}

/* Cores por tipo */
.kpi--brand   { --kpi-color: var(--ui-accent); }
.kpi--success { --kpi-color: #22c55e; } /* verde */
.kpi--danger  { --kpi-color: #ef4444; } /* vermelho */
