/* Farol: estilo compartilhado pelo painel (Shadow DOM do farol.js) e pelo site farol.trihair.app.
   Tokens copiados da Vitrina (pedidos/src/app/globals.css). */
:host, :root {
  --brand-50: #f5f3ff; --brand-100: #ede9fe; --brand-200: #ddd6fe; --brand-300: #c4b5fd; --brand-400: #a78bfa;
  --brand-500: #7c3aed; --brand-600: #5b21b6; --brand-700: #4c1d95; --brand-800: #3b0764; --brand-900: #2e1065;
  --canvas: #f3f3f3; --surface: #ffffff; --surface-alt: #f8f8f8;
  --ink: #333333; --ink-strong: #212121; --ink-muted: #616161;
  --line: #e7e7e7; --line-strong: #e0e0e0;
  --amber-soft: #fff4e0; --amber-ink: #8a5300; --green-soft: #e4f8e9; --green-ink: #006e08;
  --rose-soft: #fdecea; --rose-ink: #c62828; --slate-soft: #eeeeee; --slate-ink: #555555;
  --sombra: 0 1px 1px rgba(50, 50, 50, .13);
  --raio: 5px;
}
:host { all: initial; }
* { box-sizing: border-box; }
.fa, .fa-site { font: 14px/1.5 "Open Sans", system-ui, sans-serif; color: var(--ink); -webkit-text-size-adjust: 100%; }
:where(.fa, .fa-site) :where(button, input, textarea, select) { font: inherit; color: inherit; } /* :where = especificidade 0, não briga com .input */
.fa [hidden], .fa-site [hidden] { display: none !important; }

/* ---------- componentes ---------- */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--raio); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-primary { height: 42px; padding: 0 18px; border: 0; background: var(--brand-600); color: #fff !important; font-size: 14px; }
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-secondary { height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--brand-600) !important; font-size: 13px; }
.btn-secondary:hover { background: var(--brand-50); }
.btn-bloco { display: flex; width: 100%; }
.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--raio);
  padding: 8px 10px; font-size: 16px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); outline: none;
}
.input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
textarea.input { min-height: 96px; resize: vertical; display: block; }
input.input, select.input { height: 40px; }
.input::placeholder { color: #8a8a8a; }
@media (min-width: 640px) { .input { font-size: 14px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.card-titulo { background: var(--surface-alt); border-bottom: 1px solid var(--line); padding: 10px 16px; font-weight: 600; color: var(--ink-strong); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.filtros { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filtros select, .select { height: 34px; border: 1px solid var(--line-strong); border-radius: var(--raio); padding: 0 8px; background: var(--surface); font-size: 13px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-muted); border-bottom: 1px solid var(--line-strong); padding: 8px 12px; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td, .table tr.sel td { background: var(--brand-50); }
.table td.dia { background: var(--canvas); font-size: 12.5px; font-weight: 500; color: var(--ink-muted); padding: 5px 16px; cursor: default; }

.grupo-titulo { padding: 0 16px 6px; margin-top: 14px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.grupo { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grupo > * + * { border-top: 1px solid var(--line); }
.grupo-vazio { padding: 12px 16px; color: var(--ink-muted); font-size: 13px; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.novo { background: var(--brand-100); color: var(--brand-700); }
.badge.andamento { background: var(--amber-soft); color: var(--amber-ink); }
.badge.resolvido { background: var(--green-soft); color: var(--green-ink); }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--raio); overflow: hidden; background: var(--surface); }
.seg button { flex: 1; border: 0; background: none; padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--brand-600); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--brand-600); color: #fff; }

.tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--brand-600); box-shadow: inset 0 -2px 0 var(--brand-600); }

.logo { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand-600); }
.logo i { width: 18px; height: 18px; border-radius: 5px; background: var(--brand-600); display: inline-block; position: relative; }
.logo i::after { content: ""; position: absolute; left: 5px; top: 3px; width: 8px; height: 12px; border-radius: 2px 2px 0 0; background: #fff; opacity: .9; }

.alerta { border-left: 2px solid var(--brand-600); padding: 2px 0 2px 10px; font-size: 13px; color: var(--brand-700); }
.alerta.erro { border-color: var(--rose-ink); color: var(--rose-ink); }
.aviso-ok { background: var(--green-soft); color: var(--green-ink); border-radius: var(--raio); padding: 8px 12px; font-weight: 600; font-size: 13px; }

/* conversa (painel e gestão) */
.msg { border-radius: var(--raio); padding: 9px 11px; margin: 8px 0; font-size: 13.5px; max-width: 88%; overflow-wrap: anywhere; }
.msg.eu { background: var(--surface); border: 1px solid var(--line); margin-left: auto; }
.msg.admin { background: var(--brand-50); border: 1px solid var(--brand-100); }
.msg .quem { font-size: 11.5px; color: var(--ink-muted); margin-bottom: 2px; }
.msg .texto { white-space: pre-wrap; }
.msg audio { width: 100%; height: 36px; margin-top: 4px; display: block; }
.transcricao { font-size: 12.5px; color: var(--ink-muted); font-style: italic; margin-top: 5px; }
.miniaturas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.miniaturas a { width: 56px; height: 56px; border-radius: var(--raio); background: #ddd; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #555; overflow: hidden; text-decoration: none; }
.miniaturas img, .miniaturas video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- painel do funcionário ---------- */
.fa-modal { position: fixed; inset: 0; z-index: 2147483000; }
.fa-fundo { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.fa-painel { position: absolute; inset: 0; background: var(--canvas); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 640px) {
  .fa-modal .fa-painel { left: auto; width: 480px; box-shadow: -2px 0 12px rgba(0, 0, 0, .18); }
}
.fa-pagina { position: relative; min-height: 100%; height: 100%; }
.fa-pagina .fa-painel { position: relative; height: 100%; max-width: 720px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

.fa-topo { background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 8px 0 16px; min-height: 50px; display: flex; align-items: center; gap: 8px; box-shadow: var(--sombra); flex-shrink: 0; }
.fa-topo b { color: var(--ink-strong); font-size: 15px; }
.fa-topo .direita { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icone { border: 0; background: none; color: var(--ink-muted); font-size: 18px; width: 40px; height: 40px; cursor: pointer; border-radius: var(--raio); }
.icone:hover { background: var(--canvas); }
.voltar { color: var(--brand-600); font-weight: 600; font-size: 18px; margin-left: -12px; }

.fa-corpo { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0 20px; -webkit-overflow-scrolling: touch; }
.fa-corpo > .pad { margin: 0 16px; }
.fa-corpo > * + .pad { margin-top: 10px; }
.contexto { margin: 0 16px 10px; font-size: 12px; color: var(--ink-muted); }
.contexto b { color: var(--ink); font-weight: 600; }
.fa-rodape { padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); flex-shrink: 0; }

.acao { display: flex; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 13px 16px; color: var(--brand-600); font-size: 15px; cursor: pointer; }
.acao:hover { background: var(--brand-50); }
.acao:disabled { color: var(--ink-muted); cursor: default; background: none; }
.acao .ic { display: inline-block; width: 26px; }
.anexo { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; font-size: 13px; min-height: 46px; }
.anexo .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anexo audio { flex: 1; min-width: 0; height: 34px; }
.anexo .icone { width: 34px; height: 34px; font-size: 15px; flex-shrink: 0; }
.gravando { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--rose-ink); font-weight: 600; }
.gravando .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--rose-ink); animation: fa-pisca 1s infinite; }
.gravando .btn-secondary { margin-left: auto; }
@keyframes fa-pisca { 50% { opacity: .2; } }

.item { display: block; width: 100%; border: 0; background: var(--surface); text-align: left; padding: 10px 16px; cursor: pointer; }
.item:hover { background: var(--brand-50); }
.item .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-strong); }
.item .d { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa { padding: 0 16px; }
.responder { display: flex; gap: 8px; align-items: flex-end; }
.responder textarea.input { min-height: 40px; height: 40px; resize: none; flex: 1; }
.responder .btn-secondary { height: 40px; padding: 0 10px; flex-shrink: 0; }
.responder .btn-primary { height: 40px; padding: 0 14px; flex-shrink: 0; }
.lista-anexos:empty { display: none; }
.fa-rodape .lista-anexos { margin: -12px -16px 8px; border-top: 0; }
.carregando { padding: 24px 16px; color: var(--ink-muted); text-align: center; }

/* ---------- site: login, sem acesso, gestão ---------- */
html, body { height: 100%; margin: 0; background: var(--canvas); }
.centro { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.caixa { width: 100%; max-width: 340px; display: grid; gap: 10px; }
.caixa h1 { margin: 0 0 4px; font-size: 18px; color: var(--ink-strong); }
.caixa p { margin: 0; }
.cheio { display: flex; flex-direction: column; height: 100%; }
.cheio > .fa-pagina { flex: 1; min-height: 0; }
.faixa-sair { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 4px 8px; font-size: 12px; color: var(--ink-muted); background: var(--surface); border-top: 1px solid var(--line); }
.faixa-sair button { border: 0; background: none; color: var(--brand-600); font-weight: 600; cursor: pointer; font-size: 12px; }

.g { display: flex; flex-direction: column; height: 100%; }
.g-topo { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--sombra); min-height: 54px; padding: 0 16px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.g-busca { max-width: 380px; flex: 1; height: 36px; }
.g-topo .direita { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.g-usuario { color: var(--ink-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.g-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(420px, 5fr) 6fr; gap: 16px; padding: 16px; }
.g-lista, .g-detalhe { display: flex; flex-direction: column; min-height: 0; }
.g-scroll { flex: 1; min-height: 0; overflow: auto; }
.g-lista .table th { position: sticky; top: 0; background: var(--surface); }
.pad-g { padding: 12px 16px; }
.so-movel { display: none; }
.g-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.g-meta div { overflow-wrap: anywhere; }
.g-meta span { display: block; font-size: 11.5px; color: var(--ink-muted); }
.g-detalhe .conversa { padding: 8px 16px 12px; }
.msg.dir { margin-left: auto; }
.msg.esq { margin-left: 0; margin-right: auto; }
.g-detalhe .fa-rodape { display: grid; gap: 8px; }
.g-detalhe .fa-rodape .lista-anexos { margin: 0; }
.g-acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.g-acoes .btn-primary { height: 36px; font-size: 13px; }
.g-acoes .espaco { flex: 1; }
@media (max-width: 1023px) {
  .g-corpo { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .g-corpo .g-detalhe { display: none; }
  .g-corpo.ver-detalhe .g-lista { display: none; }
  .g-corpo.ver-detalhe .g-detalhe { display: flex; }
  .g-corpo .card { border-radius: 0; border-width: 0; }
  .so-movel { display: inline-block; }
  .g-card-titulo .voltar { margin-left: -8px; }
  .g-topo { gap: 8px; padding: 0 8px 0 12px; }
  .g-usuario { display: none; }
}
@media (max-width: 639px) { .hide-sm { display: none; } }
