/* ============================================================
   Estilos reutilizáveis dos módulos (tabelas, toolbars, badges, formulários)
   ============================================================ */

.wt-cabecalho-tela { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.wt-cabecalho-tela h1 { margin-bottom: 0; }

/* cartões de estatística */
.wt-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.wt-stat { display: flex; align-items: center; gap: 12px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; padding: 13px 18px; min-width: 170px; }
.wt-stat-ic { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; }
.wt-stat-ic.azul { background: #e8effc; color: #1d4ed8; }
.wt-stat-ic.verde { background: #e7f6ee; color: #16a34a; }
.wt-stat strong { display: block; font-size: 22px; color: var(--tinta); line-height: 1.1; }
.wt-stat span { font-size: 12.5px; color: var(--muted); }

/* toolbar (busca + filtros) */
.wt-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.wt-busca { flex: 1; min-width: 220px; max-width: 440px; }
.wt-filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.wt-chip { border: 1px solid var(--borda); background: var(--superficie); color: var(--ink-2); border-radius: 999px; padding: 7px 15px; font-size: 13px; font-weight: 600; }
.wt-chip:hover { border-color: #1d4ed8; color: #1d4ed8; }
.wt-chip.ativo { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* tabela */
.wt-tabela-wrap { background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; overflow-x: auto; }
.wt-tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wt-tabela thead th { text-align: left; padding: 12px 16px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); border-bottom: 1px solid var(--borda); white-space: nowrap; }
.wt-tabela tbody td { padding: 11px 16px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.wt-tabela tbody tr:last-child td { border-bottom: 0; }
.wt-tabela tbody tr { cursor: pointer; transition: background 0.12s; }
.wt-tabela tbody tr:hover { background: #f6f9fe; }
.wt-tabela td .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.wt-tabela td.acoes { text-align: right; white-space: nowrap; }
.wt-tabela th.num, .wt-tabela td.num { text-align: right; white-space: nowrap; }
.wt-carregando, .wt-vazio-mini { padding: 34px; text-align: center; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: center; }

/* badges */
.wt-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; margin-right: 4px; }
.wt-badge.azul { background: #e8effc; color: #1d4ed8; }
.wt-badge.verde { background: #e7f6ee; color: #16a34a; }
.wt-badge-cor { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 11px; border-radius: 999px; color: #fff; background: var(--c, #64748b); white-space: nowrap; }
.wt-cor-amostra { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,.1); }
.wt-color { width: 46px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.wt-stat-ic.amarelo { background: #fef3c7; color: #d97706; }
.wt-stat-ic.vermelho { background: #fee2e2; color: #dc2626; }
.wt-badge.amarelo { background: #fef3c7; color: #b45309; }
.wt-badge.vermelho { background: #fee2e2; color: #dc2626; }

/* tags (técnicos), linha de adição inline e total da OS */
.wt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wt-tag { display: inline-flex; align-items: center; gap: 6px; background: #e8effc; color: #1d4ed8; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12.5px; font-weight: 600; }
.wt-tag button { background: none; border: 0; color: #1d4ed8; display: inline-flex; cursor: pointer; padding: 2px; }
.wt-add-inline { display: flex; gap: 8px; align-items: center; }
.wt-total-os { display: flex; align-items: center; gap: 12px; background: #f1f5f9; border: 1px solid var(--borda); border-radius: 10px; padding: 10px 16px; }
.wt-total-os span { font-weight: 700; color: #16307a; }
.wt-total-os input { flex: 1; border: 0; background: none; font-size: 21px; font-weight: 800; color: #16307a; text-align: right; }

/* modal extra-largo (OS) */
.modal.modal-xl { max-width: 880px; width: 100%; }
.modal-xl .modal-corpo { max-height: 72vh; overflow-y: auto; }

/* ---------- dashboard ---------- */
.wt-db-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.wt-card { background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; padding: 18px; }
.wt-card h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--tinta); margin-bottom: 14px; }
.wt-card h3 svg { color: #1d4ed8; }
.wt-tabela-mini td { padding: 8px 6px; font-size: 13px; border-bottom: 1px solid var(--grid); }
.wt-tabela-mini tr:last-child td { border-bottom: 0; }

.wt-bars { display: flex; align-items: flex-end; gap: 10px; height: 172px; }
.wt-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.wt-bar-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.wt-bar-val { font-size: 10px; font-weight: 700; color: #16307a; margin-bottom: 3px; white-space: nowrap; }
.wt-bar { width: 66%; max-width: 42px; background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-radius: 5px 5px 0 0; min-height: 3px; transition: filter 0.15s; }
.wt-bar:hover { filter: brightness(1.12); }
.wt-bar-lbl { font-size: 11px; color: var(--muted); margin-top: 6px; }

.wt-hbars { display: flex; flex-direction: column; gap: 9px; }
.wt-hbar-row { display: flex; align-items: center; gap: 10px; }
.wt-hbar-lbl { width: 132px; font-size: 12.5px; color: var(--ink-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.wt-hbar-track { flex: 1; background: var(--grid); border-radius: 999px; height: 14px; overflow: hidden; }
.wt-hbar { height: 100%; border-radius: 999px; min-width: 4px; }
.wt-hbar-val { width: 34px; font-size: 12.5px; font-weight: 700; color: var(--tinta); }

@media (max-width: 860px) { .wt-db-grid { grid-template-columns: 1fr; } .wt-hbar-lbl { width: 92px; } }

/* ---------- permissões (usuários) ---------- */
.wt-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.wt-perm-grupo { border: 1px solid var(--borda); border-radius: 10px; padding: 12px 14px; }
.wt-perm-grupo > strong { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; color: #1d4ed8; margin-bottom: 8px; }
.wt-perm { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 3px 0; cursor: pointer; }
.wt-perm input { width: 16px; height: 16px; accent-color: #1d4ed8; }

/* ---------- status (MFA / SMTP) ---------- */
.wt-mfa-status { display: flex; align-items: center; gap: 12px; background: #f7f9fc; border: 1px solid var(--borda); border-radius: 12px; padding: 14px 16px; }
.wt-mfa-status svg { color: var(--muted); flex-shrink: 0; }
.wt-mfa-status.on { background: #e9f7ee; border-color: #bbe6c9; }
.wt-mfa-status.on svg { color: #16a34a; }
.wt-mfa-status > div { flex: 1; }
.wt-mfa-status strong { display: block; font-size: 14px; }
.wt-mfa-status span { font-size: 12.5px; color: var(--muted); }

/* ---------- slots de logo (Visual) ---------- */
.wt-logos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.wt-logo-slot { border: 1px solid var(--borda); border-radius: 12px; padding: 14px; text-align: center; }
.wt-logo-previa { height: 90px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.wt-logo-previa img { max-width: 90%; max-height: 74px; object-fit: contain; }
.wt-logo-slot strong { display: block; font-size: 12.5px; margin-bottom: 8px; color: var(--ink-2); }

/* modal de formulário (mais largo, corpo rolável) */
.modal.modal-largo { max-width: 720px; width: 100%; }
.modal-largo .modal-corpo { max-height: 68vh; overflow-y: auto; }

/* abas do formulário */
.wt-abas { display: flex; gap: 2px; border-bottom: 1px solid var(--borda); margin-bottom: 18px; flex-wrap: wrap; }
.wt-aba { border: 0; background: transparent; padding: 9px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.wt-aba:hover { color: #1d4ed8; }
.wt-aba.ativo { color: #1d4ed8; border-bottom-color: #1d4ed8; }

.wt-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.wt-form-grid .col-2 { grid-column: span 2; }
.wt-flags { display: flex; gap: 20px; grid-column: span 2; }
.wt-flag { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.wt-flag input { width: 17px; height: 17px; accent-color: #1d4ed8; }
.wt-textarea { width: 100%; border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; background: var(--superficie); }
.wt-textarea:focus { outline: 0; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }

.wt-form-foto { display: flex; align-items: center; gap: 14px; grid-column: span 2; }
.wt-form-foto .previa { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: #eef2f8; border: 1px solid var(--borda); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.wt-form-foto .previa img { width: 100%; height: 100%; object-fit: cover; }

/* sublistas dentro do form (acessos/anexos) */
.wt-sublista { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.wt-item-acesso { display: flex; align-items: center; gap: 12px; background: #f7f9fc; border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; }
.wt-item-acesso .info { flex: 1; min-width: 0; }
.wt-item-acesso .info strong { font-size: 13.5px; }
.wt-item-acesso .info span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt-add-bloco { border-top: 1px dashed var(--borda); padding-top: 14px; }
.wt-anexos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 8px; }
.wt-anexo-card { position: relative; border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: #f7f9fc; }
.wt-anexo-card img { width: 100%; height: 100%; object-fit: cover; }
.wt-anexo-card [data-del] { position: absolute; top: 4px; right: 4px; background: rgba(15, 23, 42, 0.6); color: #fff; width: 26px; height: 26px; }
.wt-anexo-card [data-del]:hover { background: #dc2626; }
.wt-form-nota { background: #eaf1fe; color: #1e46b0; padding: 12px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; }

@media (max-width: 640px) {
  .wt-form-grid { grid-template-columns: 1fr; }
  .wt-form-grid .col-2, .wt-flags, .wt-form-foto { grid-column: auto; }
}
