/* ==========================================================================
   v5.1 — ATENDIMENTO: chamados (atd-) e correspondência (corr-).
   Nos dois lados: a Recepção do cliente (/support) e o Atendimento da
   unidade (/unit/tickets, /unit/ticket, /unit/mail). O resto vem do
   boffice.css (cartões, campos, pílulas, abas).
   ========================================================================== */

/* ------------------------------------------------------------- comuns */
.atd-h3{ display:flex; align-items:center; gap:.45rem; }
.atd-h3 svg{ width:18px; height:18px; flex:none; color:var(--ps-mid); }

/* Barra acima das listas: filtros à esquerda, busca à direita. */
.atd-bar{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.6rem 1rem; margin:0 0 1rem; }
.atd-filters{ display:flex; flex-wrap:wrap; gap:.35rem; }
.atd-filters .ps-chip-btn b{ font-size:.72rem; font-weight:700; line-height:1; padding:.18rem .4rem; margin-left:.1rem;
  border-radius:99px; background:var(--ps-surface-2); color:var(--ps-ink); }
.atd-filters .ps-chip-btn.is-accent b{ background:rgba(var(--ps-accent-rgb),.22); }
.atd-search{ flex:0 1 22rem; min-width:12rem; margin:0; }
.atd-search .ps-input{ height:2.35rem; }
@media (max-width:575.98px){ .atd-search{ flex:1 1 100%; } }

/* Linhas de lista (chamado ou peça de correspondência). */
.atd-list, .corr-list{ display:flex; flex-direction:column; gap:.45rem; }
.atd-row, .corr-row{
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.75rem;
  padding:.75rem .9rem; background:var(--ps-surface); border:1px solid var(--ps-border);
  border-radius:var(--ps-r); color:var(--ps-ink); text-decoration:none;
  transition:border-color .15s, box-shadow .15s;
}
a.atd-row:hover{ border-color:var(--ps-border-strong); box-shadow:var(--ps-shadow); color:var(--ps-ink); }
a.atd-row:focus-visible{ outline:2px solid var(--ps-ring); outline-offset:2px; }
.atd-row > .ps-pill, .corr-row > .ps-pill{ white-space:nowrap; }
.atd-row.is-new{ box-shadow:inset 3px 0 0 var(--ps-accent); }
.atd-row.is-new b{ font-weight:700; }
.atd-row-ic, .corr-row-ic{
  width:2.25rem; height:2.25rem; flex:none; border-radius:10px; display:grid; place-items:center;
  background:var(--ps-surface-2); color:var(--ps-ink-2);
}
.atd-row-ic svg, .corr-row-ic svg{ width:17px; height:17px; }
.atd-row-dot{ width:10px; height:10px; border-radius:50%; margin:0 .15rem; flex:none; }
.atd-row-txt, .corr-row-txt{ display:flex; flex-direction:column; min-width:0; line-height:1.3; }
.atd-row-txt b, .corr-row-txt b{ font-weight:600; font-size:.92rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.atd-row-txt small, .corr-row-txt small{ font-size:.78rem; color:var(--ps-ink-3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:420px){
  .atd-row, .corr-row{ grid-template-columns:auto minmax(0,1fr); }
  .atd-row > .ps-pill, .corr-row > .ps-pill{ grid-column:2; justify-self:start; }
}

/* ------------------------------------------------------ abrir chamado */
.ps-form-card.atd-new{ padding:0; }
.atd-new-sum{
  display:flex; align-items:center; gap:.5rem; padding:.95rem 1.25rem; cursor:pointer;
  font-weight:600; list-style:none; border-radius:var(--ps-r-lg);
}
.atd-new-sum::-webkit-details-marker{ display:none; }
.atd-new-sum svg{ width:18px; height:18px; flex:none; color:var(--ps-mid); transition:transform .2s var(--ps-ease); }
.atd-new-sum:hover{ background:var(--ps-surface-2); }
.atd-new-sum:focus-visible{ outline:2px solid var(--ps-ring); outline-offset:-2px; }
.atd-new[open] .atd-new-sum{ border-bottom:1px solid var(--ps-border); border-radius:var(--ps-r-lg) var(--ps-r-lg) 0 0; }
.atd-new[open] .atd-new-sum svg{ transform:rotate(45deg); }
.atd-new-form{ padding:1.1rem 1.25rem 1.25rem; }
.atd-text{ min-height:6.5rem; resize:vertical; line-height:1.5; }

/* --------------------------------------------------- um chamado: topo */
.atd-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem 1rem; }
.atd-head-txt{ min-width:0; }
.atd-head-txt .ps-h2-inline{ font-size:1.08rem; overflow-wrap:anywhere; }
.atd-head-txt .ps-hint svg{ width:15px; height:15px; vertical-align:-2px; color:var(--ps-ink-3); }
.atd-head-acts{ display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:.45rem; flex:none; }
.atd-head-acts form{ margin:0; }
.atd-head-acts .btn svg{ width:15px; height:15px; vertical-align:-2px; }
.atd-head > .ps-pill{ flex:none; }
@media (max-width:575.98px){
  .atd-head{ flex-direction:column; }
  .atd-head-acts{ justify-content:flex-start; }
}

/* ------------------------------------------------------------ a conversa */
.atd-thread{ display:flex; flex-direction:column; gap:.75rem; }
.atd-msg{
  align-self:flex-start; max-width:min(44rem, 88%); padding:.75rem .95rem;
  background:var(--ps-surface); border:1px solid var(--ps-border);
  border-radius:6px 16px 16px 16px; scroll-margin-top:5rem;
}
.atd-msg.is-mine{
  align-self:flex-end; border-radius:16px 6px 16px 16px;
  background:var(--ps-grad-soft), var(--ps-surface); border-color:rgba(var(--ps-accent-rgb),.38);
}
.atd-msg.is-internal{
  border-style:dashed; border-color:rgba(217,119,6,.5);
  background:linear-gradient(rgba(245,158,11,.07), rgba(245,158,11,.07)), var(--ps-surface);
}
[data-bs-theme="dark"] .atd-msg.is-internal{
  border-color:rgba(251,191,36,.38);
  background:linear-gradient(rgba(245,158,11,.09), rgba(245,158,11,.09)), var(--ps-surface);
}
.atd-msg-h{ display:flex; align-items:center; flex-wrap:wrap; gap:.25rem .5rem; margin:0 0 .3rem; font-size:.8rem; color:var(--ps-ink-2); }
.atd-msg-h b{ color:var(--ps-ink); font-weight:600; }
.atd-msg-h time{ margin-left:auto; color:var(--ps-ink-3); font-size:.76rem; white-space:nowrap; }
.atd-msg-h .ps-pill{ font-size:.68rem; }
.atd-msg-b{ font-size:.93rem; line-height:1.55; color:var(--ps-ink); overflow-wrap:anywhere; }
.atd-file{
  display:flex; flex-direction:column; gap:.4rem; width:fit-content; max-width:100%; margin-top:.6rem;
  padding:.45rem .6rem; border:1px solid var(--ps-border); border-radius:10px; background:var(--ps-surface-2);
  color:var(--ps-ink); font-size:.82rem; text-decoration:none;
}
.atd-file:hover{ border-color:var(--ps-border-strong); color:var(--ps-ink); }
.atd-file span{ display:inline-flex; align-items:center; gap:.35rem; min-width:0; overflow-wrap:anywhere; }
.atd-file svg{ width:15px; height:15px; flex:none; color:var(--ps-ink-3); }
.atd-file small{ color:var(--ps-ink-3); margin-left:.2rem; white-space:nowrap; }
.atd-file.is-img img{ display:block; max-width:min(260px, 100%); max-height:200px; border-radius:7px; object-fit:cover; background:var(--ps-surface); }

/* ------------------------------------------------------------- responder */
.atd-reply.is-internal{
  border-style:dashed; border-color:rgba(217,119,6,.55);
  background:linear-gradient(rgba(245,158,11,.06), rgba(245,158,11,.06)), var(--ps-surface);
}
[data-bs-theme="dark"] .atd-reply.is-internal{ border-color:rgba(251,191,36,.38); }
.atd-reply-foot{ display:flex; align-items:center; flex-wrap:wrap; gap:.6rem 1rem; }
.atd-reply-foot .btn{ margin-left:auto; }
.atd-attach{
  position:relative; display:inline-flex; align-items:center; gap:.4rem; max-width:100%; margin:0;
  padding:.4rem .75rem; border:1px dashed var(--ps-border-strong); border-radius:9px;
  color:var(--ps-ink-2); font-size:.84rem; cursor:pointer; background:var(--ps-surface);
}
.atd-attach:hover{ border-color:var(--ps-ink-3); color:var(--ps-ink); }
.atd-attach:focus-within{ outline:2px solid var(--ps-ring); outline-offset:2px; }
.atd-attach svg{ width:16px; height:16px; flex:none; }
.atd-attach span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:16rem; }
.atd-attach input[type=file]{ position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.atd-attach.has-file{ border-style:solid; border-color:var(--ps-mid); color:var(--ps-ink); }
.atd-attach.has-error{ border-color:var(--ps-danger); color:var(--ps-danger); }
.atd-internal{ margin:0; font-size:.86rem; }

/* ===================================================== correspondência */

/* Cliente: o uso do mês. */
.corr-uso{ display:flex; align-items:flex-start; gap:1rem; }
.corr-uso-ic{
  width:2.75rem; height:2.75rem; flex:none; border-radius:12px; display:grid; place-items:center;
  background:var(--ps-grad-soft); color:var(--ps-mid); border:1px solid var(--ps-border);
}
.corr-uso-ic svg{ width:20px; height:20px; }
.corr-uso-txt{ display:flex; flex-direction:column; gap:.3rem; min-width:0; flex:1; font-size:.9rem; color:var(--ps-ink-2); }
.corr-uso-txt b{ color:var(--ps-ink); font-size:.98rem; }
.corr-uso-txt b::first-letter{ text-transform:uppercase; }
.corr-bar{ display:block; height:7px; max-width:22rem; border-radius:99px; overflow:hidden;
  background:var(--ps-surface-2); border:1px solid var(--ps-border); }
.corr-bar i{ display:block; height:100%; background:var(--ps-mid); border-radius:inherit; }
.corr-extra{ color:var(--ps-late); font-weight:600; }
[data-bs-theme="dark"] .corr-extra{ color:#fbbf4a; }
.corr-row.is-waiting{ box-shadow:inset 3px 0 0 #f59e0b; }

/* Unidade: registrar. */
.corr-new .ps-h2-inline{ display:flex; align-items:center; gap:.45rem; }
.corr-new-grid{ display:grid; gap:0 1rem; grid-template-columns:1fr; }
.corr-new-grid fieldset{ border:0; padding:0; margin:0 0 1rem; min-width:0; }
@media (min-width:768px){
  .corr-new-grid{ grid-template-columns:repeat(6, minmax(0,1fr)); }
  .corr-new-grid > :nth-child(1), .corr-new-grid > :nth-child(2){ grid-column:span 3; }
  .corr-new-grid > :nth-child(3){ grid-column:span 1; }
  .corr-new-grid > :nth-child(4){ grid-column:span 2; }
  .corr-new-grid > .corr-notes{ grid-column:span 3; }
}
.corr-kinds{ display:flex; flex-wrap:wrap; gap:.4rem; }
.corr-kind{ position:relative; margin:0; cursor:pointer; }
.corr-kind input{ position:absolute; opacity:0; width:1px; height:1px; pointer-events:none; }
.corr-kind span{
  display:inline-flex; align-items:center; gap:.4rem; padding:.48rem .8rem; border-radius:9px;
  border:1px solid var(--ps-border); background:var(--ps-surface); color:var(--ps-ink-2);
  font-size:.86rem; font-weight:500; transition:border-color .15s, background .15s, color .15s;
}
.corr-kind span svg{ width:16px; height:16px; flex:none; }
.corr-kind:hover span{ border-color:var(--ps-border-strong); color:var(--ps-ink); }
.corr-kind input:checked + span{ border-color:var(--ps-mid); color:var(--ps-ink); font-weight:600; background:var(--ps-grad-soft), var(--ps-surface); }
.corr-kind input:checked + span svg{ color:var(--ps-mid); }
.corr-kind input:focus-visible + span{ outline:2px solid var(--ps-ring); outline-offset:2px; }
.corr-pv{ margin:.45rem 0 0; padding:.45rem .65rem; border-radius:9px; font-size:.82rem; line-height:1.4;
  border:1px solid var(--ps-border); background:var(--ps-surface-2); color:var(--ps-ink-2); }
.corr-pv.is-included{ background:rgba(0,176,131,.09); border-color:rgba(0,176,131,.28); color:#00704f; }
.corr-pv.is-extra{ background:rgba(245,158,11,.11); border-color:rgba(245,158,11,.35); color:#8a4b00; }
[data-bs-theme="dark"] .corr-pv.is-included{ background:rgba(0,176,131,.13); border-color:rgba(62,229,180,.28); color:#3ee5b4; }
[data-bs-theme="dark"] .corr-pv.is-extra{ background:rgba(245,158,11,.13); border-color:rgba(251,191,36,.32); color:#fbbf4a; }
.corr-new-foot{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.6rem 1rem; }
.corr-new-foot .ps-check{ margin:0; }

/* Unidade: esperando retirada, por cliente. */
.corr-groups{ display:grid; gap:.75rem; grid-template-columns:repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items:start; }
.ps-form-card.corr-group{ padding:.9rem 1rem; }
.corr-group-h{ display:flex; align-items:center; flex-wrap:wrap; gap:.4rem .5rem; margin:0 0 .35rem; }
.corr-group-h b{ font-weight:600; font-size:.95rem; min-width:0; overflow-wrap:anywhere; }
.corr-group-h .ps-cat-dot{ width:9px; height:9px; margin:0; flex:none; }
.corr-group-h .ps-muted{ font-size:.8rem; }
.corr-items{ list-style:none; margin:0; padding:0; }
.corr-item{ display:flex; align-items:center; gap:.6rem; padding:.55rem 0; border-top:1px solid var(--ps-border); }
.corr-item:first-child{ border-top:0; }
.corr-item .corr-row-txt{ flex:1; }
.corr-item .ps-pill{ white-space:nowrap; flex:none; }
.corr-item .dropdown{ flex:none; }
.corr-item .dropdown-item{ display:flex; align-items:center; gap:.55rem; }
.corr-item .dropdown-item svg{ width:16px; height:16px; flex:none; opacity:.75; }
.corr-item .dropdown-item.is-danger{ color:var(--ps-out); }
.corr-item form{ margin:0; }
.corr-pickup{ display:flex; gap:.5rem; margin:.6rem 0 0; padding:.7rem 0 0; border-top:1px dashed var(--ps-border-strong); }
.corr-pickup .ps-input{ flex:1; min-width:0; height:2.2rem; font-size:.86rem; }
.corr-pickup .btn{ flex:none; white-space:nowrap; }
.corr-pickup .btn svg{ width:15px; height:15px; vertical-align:-2px; }

/* Histórico: a peça anulada fica apagada. */
.corr-hist tr.is-archived td{ color:var(--ps-ink-3); }
.corr-hist td form{ margin:0; }
.corr-hist .ps-chip-btn{ padding:.3rem .45rem; }

/* O número "quente" numa aba (correspondência esperando, chamados esperando
   a unidade): chama mais atenção que o contador comum. */
.ps-aba .ps-aba-n.is-hot{ opacity:1; font-size:.7rem; font-weight:700; line-height:1; padding:.2rem .42rem;
  border-radius:99px; background:#c2410c; color:#fff; font-variant-numeric:tabular-nums; }
[data-bs-theme="dark"] .ps-aba .ps-aba-n.is-hot{ background:#fb923c; color:#111117; }

/* Planos e preços da unidade: o preço da correspondência acima do limite. */
.ps-up-mail{ display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:.75rem 1.5rem; }
.ps-up-mail-txt{ flex:1 1 20rem; min-width:0; }
.ps-up-mail-txt .ps-h2-inline{ display:flex; align-items:center; gap:.45rem; margin-bottom:.35rem; }
.ps-up-mail > .ps-field{ flex:0 1 18rem; }
.ps-up-mail .ps-money-wrap{ flex:1; min-width:0; }

/* Voltar à lista (um chamado; os resolvidos). */
.atd-back{ display:inline-flex; align-items:center; gap:.35rem; margin:0 0 .9rem; font-size:.85rem; color:var(--ps-ink-2); text-decoration:none; }
.atd-back:hover{ color:var(--ps-mid); }
.atd-back svg{ width:15px; height:15px; flex:none; }
