/* ============================================================
   COMPONENTS — Tema Escuro Imper Credi Brasil
   ============================================================ */

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
  white-space: nowrap;
  min-height: 40px;
  line-height: 1;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary  { background: #c8102e; color: #fff; border-color: #c8102e; }
.btn-primary:hover:not(:disabled) { background: #e8203e; border-color: #e8203e; }

.btn-accent   { background: #c9a84c; color: #0a0a0a; border-color: #c9a84c; font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: #e0c070; border-color: #e0c070; }

.btn-success  { background: #22c55e; color: #fff; border-color: #22c55e; }
.btn-success:hover:not(:disabled) { background: #16a34a; }

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

.btn-info     { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.btn-info:hover:not(:disabled) { background: #2563eb; }

.btn-outline  { background: transparent; color: #c8102e; border-color: #c8102e; }
.btn-outline:hover:not(:disabled) { background: #c8102e; color: #fff; }

.btn-ghost    { background: transparent; color: #aaaaaa; border: 1px solid #2a2a2a; }
.btn-ghost:hover:not(:disabled) { background: #1c1c1c; color: #f0f0f0; border-color: #444; }

.btn-sm    { padding: 4px 12px; font-size: 12px; min-height: 30px; border-radius: 6px; }
.btn-lg    { padding: 12px 32px; font-size: 16px; min-height: 48px; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn-full  { width: 100%; }
.btn-icon  { width: 36px; height: 36px; padding: 0; border-radius: 6px; }

/* === CARDS === */
.card {
  background: #141414;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: #f0f0f0;
  display: flex; align-items: center; gap: 8px;
}
.card-body   { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 12px 20px; border-top: 1px solid #2a2a2a;
  background: #0d0d0d;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* === INFO LIST (linhas rótulo/valor dentro de cards) === */
.info-list { display: flex; flex-direction: column; gap: 0; }
.info-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #222;
}
.info-item:last-child { border-bottom: none; padding-bottom: 0; }
.info-item:first-child { padding-top: 0; }
.info-label {
  font-size: 13px;
  color: #8a8a8a;
  flex-shrink: 0;
  min-width: 110px;
}
.info-value {
  font-size: 13px;
  color: #f0f0f0;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}
@media (max-width: 480px) {
  .info-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .info-value { text-align: left; }
}

/* === STAT CARDS === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stats-grid-3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stats-grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat-card {
  background: #141414;
  border-radius: 12px; padding: 20px;
  border: 1px solid #2a2a2a;
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color 150ms ease;
}
.stat-card:hover { border-color: #a07828; }

.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

/* Todas as variantes de stat-icon — visíveis no fundo escuro */
.stat-icon.primary  { background: rgba(200,16,46,0.2);  color: #ff6080; }
.stat-icon.accent   { background: rgba(201,168,76,0.2); color: #e0c070; }
.stat-icon.success  { background: rgba(34,197,94,0.15); color: #4ade80; }
.stat-icon.danger   { background: rgba(239,68,68,0.15); color: #f87171; }
.stat-icon.warning  { background: rgba(245,158,11,0.15);color: #fbbf24; }
.stat-icon.info     { background: rgba(59,130,246,0.15);color: #60a5fa; }

/* Variantes novas (stats-grid) */
.stat-red    .stat-icon,
.stat-red    { --si-bg: rgba(200,16,46,0.2);  --si-color: #ff6080; }
.stat-gold   .stat-icon,
.stat-gold   { --si-bg: rgba(201,168,76,0.2); --si-color: #e0c070; }
.stat-green  .stat-icon { background: rgba(34,197,94,0.15);  color: #4ade80; }
.stat-blue   .stat-icon { background: rgba(59,130,246,0.15); color: #60a5fa; }
.stat-yellow .stat-icon { background: rgba(245,158,11,0.15); color: #fbbf24; }
.stat-purple .stat-icon { background: rgba(139,92,246,0.15); color: #a78bfa; }
.stat-teal   .stat-icon { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.stat-orange .stat-icon { background: rgba(249,115,22,0.15); color: #fb923c; }
.stat-gray   .stat-icon { background: #242424; color: #888888; }
.stat-red    .stat-icon { background: rgba(200,16,46,0.2); color: #ff6080; }
.stat-gold   .stat-icon { background: rgba(201,168,76,0.2);color: #e0c070; }

.stat-info  { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11px; color: #888888;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.stat-value { font-size: 22px; font-weight: 700; color: #f0f0f0; line-height: 1.2; }
.stat-sub   { font-size: 11px; color: #666666; margin-top: 2px; }
.stat-body  { flex: 1; min-width: 0; }

/* === BADGE === */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.15);  color: #4ade80; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-info    { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-primary { background: rgba(200,16,46,0.2);   color: #ff6080; }
.badge-gold    { background: rgba(201,168,76,0.2);  color: #e0c070; }
.badge-gray, .badge-neutral { background: #242424; color: #888888; }
.badge-accent  { background: rgba(201,168,76,0.2);  color: #e0c070; }

/* === FORMS === */
.form-group   { margin-bottom: 16px; }
.form-grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

label, .form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: #aaaaaa; margin-bottom: 8px;
}
.req { color: #c8102e; margin-left: 2px; }

input[type="text"], input[type="email"], input[type="number"],
input[type="password"], input[type="date"], input[type="search"],
select, textarea, .form-control {
  width: 100%; padding: 8px 12px;
  background: #1c1c1c; border: 1.5px solid #2a2a2a;
  border-radius: 10px; color: #f0f0f0;
  font-size: 13px; min-height: 42px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus, select:focus, textarea:focus, .form-control:focus {
  outline: none; border-color: #c8102e;
  box-shadow: 0 0 0 3px rgba(200,16,46,0.12);
}
input::placeholder, textarea::placeholder { color: #555555; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.45; cursor: not-allowed; }

select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23888' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
select option { background: #1c1c1c; color: #f0f0f0; }
textarea { resize: vertical; min-height: 80px; }

.form-control-sm { min-height: 34px; padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.form-hint  { font-size: 11px; color: #666666; margin-top: 4px; }
.form-error { font-size: 11px; color: #ef4444; margin-top: 4px; }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: #ef4444; }

/* === DATA TABLE === */
.table-wrapper, .table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead tr { background: #1c1c1c; }
.data-table th {
  padding: 12px 16px; font-size: 11px; font-weight: 600;
  color: #888888; text-transform: uppercase; letter-spacing: 0.5px;
  text-align: left; white-space: nowrap; border-bottom: 1px solid #2a2a2a;
}
.data-table td {
  padding: 12px 16px; color: #f0f0f0;
  border-bottom: 1px solid #1e1e1e; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #1c1c1c; }
.table-empty { text-align: center; color: #666666; padding: 32px !important; }

.table-toolbar {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #2a2a2a; align-items: center;
}
.table-search {
  flex: 1; min-width: 180px; padding: 6px 12px;
  background: #1c1c1c; border: 1px solid #2a2a2a;
  border-radius: 8px; color: #f0f0f0; font-size: 13px;
}
.table-search:focus { outline: none; border-color: #c8102e; }
.table-search::placeholder { color: #555; }
.table-count { font-size: 11px; color: #666666; white-space: nowrap; }
.table-actions { display: flex; gap: 4px; align-items: center; }

.btn-table-action {
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  border: 1px solid #2a2a2a; background: #1c1c1c; color: #aaaaaa;
  cursor: pointer; transition: all 150ms ease;
}
.btn-table-action:hover { border-color: #c9a84c; color: #c9a84c; }

/* Paginação */
.table-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid #2a2a2a;
}
.pagination-info { font-size: 11px; color: #666666; }
.pagination-controls { display: flex; gap: 4px; }
.pagination-ellipsis { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: #666; }
.btn-page {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; color: #888888;
  border: 1px solid #2a2a2a; background: #1c1c1c;
  transition: all 150ms ease;
}
.btn-page:hover:not(:disabled) { border-color: #c9a84c; color: #c9a84c; }
.btn-page.active { background: #c8102e; color: #fff; border-color: #c8102e; }
.btn-page:disabled { opacity: 0.3; cursor: not-allowed; }

/* === MODAL === */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fadeIn 150ms ease;
}
.modal {
  background: #141414; border: 1px solid #2a2a2a;
  border-radius: 20px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 250ms ease; box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid #2a2a2a;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #141414; z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 600; color: #f0f0f0; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #888; font-size: 18px; cursor: pointer; }
.modal-close:hover { background: #1c1c1c; color: #f0f0f0; }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #2a2a2a; display: flex; justify-content: flex-end; gap: 8px; }

/* === TOAST container === */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }

/* === ALERTS === */
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,0.12);  color: #4ade80; border-color: rgba(34,197,94,0.2); }
.alert-danger  { background: rgba(239,68,68,0.12);  color: #f87171; border-color: rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border-color: rgba(245,158,11,0.2); }
.alert-info    { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.2); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 48px 16px; color: #666666; }
.empty-icon  { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: #f0f0f0; margin-bottom: 8px; }

/* === DETAIL TABLE === */
.detail-table { width: 100%; }
.detail-table td { padding: 8px 12px; vertical-align: top; font-size: 13px; border-bottom: 1px solid #1e1e1e; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-label { color: #888888; width: 40%; font-weight: 500; }
.detail-value { color: #f0f0f0; }

/* === TABS === */
.tabs { display: flex; border-bottom: 1px solid #2a2a2a; margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { display: none; height: 0; }
.tab-item { padding: 12px 16px; font-size: 13px; font-weight: 500; color: #888888; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 150ms ease; }
.tab-item:hover { color: #f0f0f0; }
.tab-item.active { color: #c9a84c; border-bottom-color: #c9a84c; font-weight: 600; }

/* === MISC === */
.divider   { border: none; border-top: 1px solid #2a2a2a; margin: 16px 0; }
.text-muted   { color: #888888; }
.text-danger  { color: #f87171; }
.text-success { color: #4ade80; }
.text-gold    { color: #c9a84c; }
.text-center  { text-align: center; }
.text-sm      { font-size: 13px; }
.mb-5         { margin-bottom: 20px; }
.link         { color: #c9a84c; cursor: pointer; }
.link:hover   { text-decoration: underline; }
.info-row     { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: #888888; }
.action-buttons { display: flex; flex-direction: column; gap: 8px; }

/* === TOGGLE SWITCH ===
   Usado em Comissões (ativar/desativar regra) e Disparos (ativar/desativar
   modelo de mensagem) — faltava o CSS, o checkbox aparecia sem estilo. */
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #2a2a2a; border-radius: 999px; transition: background-color .2s;
}
.toggle-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background-color: #f0f0f0; border-radius: 50%; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background-color: #c8102e; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid #c9a84c; outline-offset: 2px; }

/* === ANIMATIONS === */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   PAINEL DE BIOMETRIA (components/biometricPanel.js)
   ============================================================ */
.bio-status { font-size: 13px; color: #888; padding: 10px 12px; border: 1px solid #2a2a2a; border-radius: 8px; }
.bio-status-on { color: #22c55e; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); font-weight: 600; }
.bio-devices-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #666; margin: 14px 0 6px; }
.bio-devices { display: flex; flex-direction: column; }
.bio-device { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #1e1e1e; }
.bio-device:last-child { border-bottom: none; }
.bio-device-info { flex: 1; min-width: 0; }
.bio-device-name { font-size: 13px; color: #f0f0f0; }
.bio-here { font-size: 11px; color: #c9a84c; }
.bio-device-meta { font-size: 11px; color: #777; margin-top: 2px; }
.bio-muted { font-size: 12px; color: #777; padding: 4px 0; }

/* Grupo 32 — Pessoa Jurídica */
.cf-section-title { font-size: 13px; font-weight: 700; color: #c9a84c; text-transform: uppercase; letter-spacing: .5px; margin: 4px 0 12px; }
.company-card { cursor: pointer; transition: border-color .15s; }
.company-card:hover { border-color: #3a3a3a; }

/* Grupo 40 — Portal do Lojista: proposta atualizada desde a última visita */
.data-table tr.row-updated td { background: rgba(201,168,76,.07); }
.badge-new { display:inline-block; margin-left:6px; padding:1px 7px; border-radius:999px; font-size:10px; font-weight:700; color:#0a0a0a; background:#c9a84c; vertical-align:middle; }

/* Grupo 49: campo de busca com a lupa dentro (antes a lupa ficava solta acima
   do campo em Auditoria, Clientes, Crédito e Capital — o estilo não existia) */
.search-input-wrap { position: relative; display: flex; align-items: center; flex: 1 1 200px; min-width: 0; }
.search-input-wrap .search-icon { position: absolute; left: 12px; font-size: 14px; pointer-events: none; opacity: .7; }
.search-input-wrap .search-input { width: 100%; min-height: 40px; padding-left: 36px; }

/* Grupo 50 (2026-10-12): nome do cliente nas listas em BRANCO (antes vermelho,
   difícil de ler). Passa o mouse → dourado sublinhado, mostrando que é clicável. */
.name-link { color: #fff; cursor: pointer; }
.name-link:hover { color: #c9a84c; text-decoration: underline; }

/* Grupo 50: linha da busca (campo + filtro + contador) organizada — no
   celular o campo ocupa a linha inteira e o filtro/contador vão para baixo,
   sem um ficar por cima do outro. */
.search-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-bar > select.form-control { flex: 0 1 180px; }
@media (max-width: 600px) {
  .search-bar .search-input-wrap { flex-basis: 100%; }
}
