/* =====================================================================
   SECRETARIA — atendimento público (atendimento.html) e painel de staff
   (secretaria.php). Carregar após design-system.css, layout.css, home.css.
   ===================================================================== */

/* ---------- Tabs genéricas ---------- */
.sec-tabs { display: inline-flex; gap: 4px; background: rgba(15,46,28,0.06); padding: 4px; border-radius: 999px; margin-bottom: 1.4rem; }
.sec-tabs button { border: none; background: none; font: inherit; font-weight: 700; color: var(--portal-muted, #5d6b61); padding: 0.55rem 1.1rem; border-radius: 999px; cursor: pointer; }
.sec-tabs button[aria-selected="true"] { background: #fff; color: var(--portal-green, #143a24); box-shadow: 0 4px 14px rgba(15,46,28,0.1); }
.sec-pane { display: none; }
.sec-pane.active { display: block; animation: fadeIn .3s ease; }

/* ---------- Formulário público ---------- */
.sec-form { display: grid; gap: 1rem; max-width: 640px; }
.sec-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sec-field { display: grid; gap: 0.35rem; }
.sec-field label { font-weight: 700; font-size: 0.9rem; color: var(--portal-green, #143a24); }
.sec-field input, .sec-field select, .sec-field textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 0.7rem 0.85rem;
  border: 1px solid var(--portal-line, rgba(15,46,28,0.18)); border-radius: 10px;
  background: #fff; color: var(--portal-ink, #26332c);
}
.sec-field textarea { min-height: 130px; resize: vertical; }
.sec-field input:focus, .sec-field select:focus, .sec-field textarea:focus {
  outline: none; border-color: var(--portal-green, #143a24); box-shadow: 0 0 0 3px rgba(46,125,70,0.15);
}
.sec-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sec-status-msg { margin: 0.4rem 0 0; font-weight: 600; }
.sec-status-msg.ok { color: var(--portal-green, #143a24); }
.sec-status-msg.err { color: var(--portal-accent, #c0526a); }

/* Cartão de protocolo gerado */
.sec-result { margin-top: 1.4rem; padding: 1.4rem 1.5rem; border-radius: 16px; border: 1px solid rgba(46,125,70,0.25); background: rgba(46,125,70,0.07); }
.sec-result .code { font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace); font-size: 1.5rem; font-weight: 800; color: var(--portal-green, #143a24); letter-spacing: 0.04em; }

/* ---------- Chips de status/setor ---------- */
.sec-chip { display: inline-flex; align-items: center; gap: 6px; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.sec-chip.sector { background: rgba(15,46,28,0.08); color: var(--portal-green, #143a24); }
.st-novo        { background: #e6f0ff; color: #1d4ed8; }
.st-em_andamento{ background: #fff1d6; color: #9a6b00; }
.st-aguardando  { background: #f3e8ff; color: #7c3aed; }
.st-respondido  { background: #dcfce7; color: #15803d; }
.st-concluido   { background: #e2e8f0; color: #334155; }
.st-arquivado   { background: #f1f5f9; color: #64748b; }
.pr-alta, .pr-urgente { color: var(--portal-accent, #c0526a); font-weight: 800; }

/* ---------- Painel de staff ---------- */
.sec-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1.4rem; }
.sec-stat { background: #fff; border: 1px solid var(--portal-line, rgba(15,46,28,0.12)); border-radius: 14px; padding: 0.9rem 1rem; }
.sec-stat .n { font-size: 1.6rem; font-weight: 800; color: var(--portal-green, #143a24); line-height: 1; }
.sec-stat .l { font-size: 0.8rem; color: var(--portal-muted, #5d6b61); margin-top: 4px; }
.sec-stat .o { font-size: 0.72rem; color: var(--portal-accent, #c0526a); font-weight: 700; }

.sec-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.sec-toolbar select, .sec-toolbar input { font: inherit; padding: 0.55rem 0.8rem; border: 1px solid var(--portal-line, rgba(15,46,28,0.18)); border-radius: 10px; background: #fff; }
.sec-toolbar input[type="search"] { flex: 1; min-width: 180px; }

.sec-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1.4fr); gap: 1.2rem; align-items: start; }
.sec-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 70vh; overflow: auto; padding-right: 4px; }
.sec-card { text-align: left; width: 100%; background: #fff; border: 1px solid var(--portal-line, rgba(15,46,28,0.12)); border-radius: 12px; padding: 0.85rem 1rem; cursor: pointer; transition: border-color .15s, box-shadow .15s; font: inherit; }
.sec-card:hover { border-color: var(--portal-green, #143a24); }
.sec-card.active { border-color: var(--portal-green, #143a24); box-shadow: 0 6px 18px rgba(15,46,28,0.1); }
.sec-card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sec-card .code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.78rem; color: var(--portal-muted, #5d6b61); }
.sec-card h4 { margin: 0.35rem 0 0.2rem; font-family: var(--font-body, inherit); font-size: 1rem; color: var(--portal-ink, #26332c); }
.sec-card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.78rem; color: var(--portal-muted, #5d6b61); }

.sec-detail { background: #fff; border: 1px solid var(--portal-line, rgba(15,46,28,0.12)); border-radius: 16px; padding: 1.3rem 1.4rem; position: sticky; top: 90px; }
.sec-detail .empty { color: var(--portal-muted, #5d6b61); text-align: center; padding: 2.5rem 1rem; }
.sec-detail h3 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.sec-detail .info { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; font-size: 0.86rem; margin: 0.8rem 0 1rem; }
.sec-detail .info b { color: var(--portal-green, #143a24); }
.sec-detail .desc { background: rgba(15,46,28,0.04); border-radius: 10px; padding: 0.9rem 1rem; white-space: pre-wrap; line-height: 1.55; }

.sec-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.sec-controls select { font: inherit; padding: 0.5rem 0.7rem; border: 1px solid var(--portal-line, rgba(15,46,28,0.18)); border-radius: 9px; background: #fff; }

.sec-thread { display: flex; flex-direction: column; gap: 0.7rem; margin: 1rem 0; max-height: 320px; overflow: auto; }
.sec-msg { padding: 0.7rem 0.9rem; border-radius: 12px; }
.sec-msg.resposta { background: rgba(46,125,70,0.08); }
.sec-msg.nota_interna { background: #fff7e6; border: 1px dashed rgba(245,194,75,0.6); }
.sec-msg.evento { background: transparent; color: var(--portal-muted, #5d6b61); font-size: 0.8rem; text-align: center; padding: 0.3rem; }
.sec-msg .who { font-size: 0.78rem; color: var(--portal-muted, #5d6b61); margin-bottom: 0.2rem; }
.sec-msg .who .tag-int { color: #9a6b00; font-weight: 700; }
.sec-msg p { margin: 0; white-space: pre-wrap; line-height: 1.5; }

.sec-reply textarea { width: 100%; min-height: 90px; font: inherit; padding: 0.7rem 0.85rem; border: 1px solid var(--portal-line, rgba(15,46,28,0.18)); border-radius: 10px; resize: vertical; }
.sec-reply .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.sec-reply label.note { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--portal-muted, #5d6b61); }

/* ---------- Permissões de membros (master) ---------- */
.sec-perm { margin-top: 2.5rem; }
.sec-perm-member { background: #fff; border: 1px solid var(--portal-line, rgba(15,46,28,0.12)); border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: 0.8rem; }
.sec-perm-member .head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.sec-perm-member .name { font-weight: 700; color: var(--portal-green, #143a24); }
.sec-perm-member .email { font-size: 0.82rem; color: var(--portal-muted, #5d6b61); }
.sec-sectors { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0; }
.sec-sectors label { display: inline-flex; align-items: center; gap: 6px; padding: 0.35rem 0.7rem; border: 1px solid var(--portal-line, rgba(15,46,28,0.18)); border-radius: 999px; font-size: 0.85rem; cursor: pointer; }
.sec-sectors input { accent-color: var(--portal-green, #143a24); }
.sec-badge-all { font-size: 0.8rem; color: var(--portal-muted, #5d6b61); font-style: italic; }

@media (max-width: 860px) {
  .sec-layout { grid-template-columns: 1fr; }
  .sec-detail { position: static; }
  .sec-grid-2 { grid-template-columns: 1fr; }
  .sec-list { max-height: none; }
}
