/* Estilos do Helpdesk. Simples e funcional: clareza e velocidade acima de tudo. */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f3f4f6;
  color: #1f2937;
  line-height: 1.5;
}

a { color: #2563eb; }

.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.container-estreito { max-width: 480px; }

.topo {
  background: #111827;
  color: #fff;
  padding: 12px 16px;
}
.topo .container { padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.topo a { color: #d1d5db; text-decoration: none; margin-left: 16px; }
.topo a:hover { color: #fff; }
.topo .marca { color: #fff; font-weight: 700; font-size: 18px; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #1d4ed8; }
.btn-secundario { background: #6b7280; }
.btn-secundario:hover { background: #4b5563; }

.alerta { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alerta-erro { background: #fee2e2; color: #991b1b; }
.alerta-ok { background: #dcfce7; color: #166534; }

/* Fila de tickets */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef0f2; font-size: 14px; }
th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }
tr.atencao { background: #fffbeb; }
tbody tr:hover { background: #f9fafb; }

/* Etiquetas de status e prioridade */
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-aberto { background: #fef3c7; color: #92400e; }
.st-em_andamento { background: #dbeafe; color: #1e40af; }
.st-aguardando_cliente { background: #fed7aa; color: #9a3412; }
.st-resolvido { background: #dcfce7; color: #166534; }
.st-fechado { background: #e5e7eb; color: #374151; }
.pr-baixa { background: #f3f4f6; color: #4b5563; }
.pr-normal { background: #e0e7ff; color: #3730a3; }
.pr-alta { background: #ffedd5; color: #9a3412; }
.pr-urgente { background: #fee2e2; color: #991b1b; }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filtros > div { flex: 1; min-width: 130px; }
.filtros label { margin: 0 0 4px; }

/* Thread de mensagens */
.msg { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.msg-cliente { background: #fff; }
.msg-agente { background: #eff6ff; border-color: #bfdbfe; }
.msg-sistema { background: #f9fafb; color: #6b7280; font-style: italic; }
.msg .meta { font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.msg .autor { font-weight: 700; color: #111827; }
.msg .corpo { white-space: pre-wrap; }

/* Layout do ticket no painel */
.grid-ticket { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
@media (max-width: 760px) { .grid-ticket { grid-template-columns: 1fr; } }
.lateral .card { position: sticky; top: 16px; }
.linha-acao { display: flex; gap: 8px; margin-bottom: 12px; }
.linha-acao select { flex: 1; }
.dado { margin-bottom: 8px; font-size: 14px; }
.dado b { color: #374151; }
.muted { color: #6b7280; font-size: 13px; }
.link-magico { word-break: break-all; font-size: 12px; background: #f9fafb; padding: 8px; border-radius: 6px; }
