/* Protótipo da Declaração de faturamento automática (assets/js/prototipos/declaracao.js).
   Usa as classes de prototipo.css e a conversa do site.css (.chat, .bubble, .qr); aqui só o que é novo. Prefixo pt-dec-. */
.pt-dec button:focus-visible, .pt-dec input:focus-visible, .pt-dec textarea:focus-visible, .pt-dec summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pt-dec-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 620px; }
.pt-dec-left { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 16px; border-right: 1px solid var(--line); background: #FBFBFA; }
.pt-dec-right { min-width: 0; padding: 18px 20px 20px; }
.pt-dec-lbl { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pt-dec-lbl .icon { width: 13px; height: 13px; }
.pt-dec-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.pt-dec-right .pt-head h3 { margin-top: 4px; }

/* Cliente do escritório */
.pt-dec-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pt-dec-pick > span { font-weight: 600; }
.pt-dec-pick button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--pill); background: #fff; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.pt-dec-pick button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.pt-dec-pick em { padding: 0 6px; border-radius: var(--pill); background: #25D366; font-size: 10.5px; font-style: normal; font-weight: 700; color: #fff; }

/* WhatsApp */
.pt-dec-chat { display: flex; flex-direction: column; border: 1px solid var(--line); }
.pt-dec-msgs { height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.pt-dec-msgs .bubble { overflow-wrap: anywhere; }
.pt-dec-tick { color: #53BDEB; letter-spacing: -2px; }
.pt-dec-qrs { width: auto; max-width: 92%; align-self: flex-end; }
.pt-dec-qr { border: 0; font: inherit; font-size: 12.5px; text-align: left; justify-content: flex-start; cursor: pointer; }
.pt-dec-qr:hover { background: #F7F7F7; }
.pt-dec-typing { display: inline-flex; gap: 4px; padding: 10px 12px; }
.pt-dec-typing i { width: 6px; height: 6px; border-radius: 50%; background: #8696A0; animation: pt-dec-dot 1s infinite ease-in-out; }
.pt-dec-typing i:nth-child(2) { animation-delay: .15s; }
.pt-dec-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pt-dec-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
.pt-dec-docmsg { width: 240px; max-width: 88%; padding: 4px 4px 6px; }
.pt-dec-doc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; background: #F5F6F6; }
.pt-dec-doc__ic { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 40px; border-radius: 4px; background: var(--ink); font-size: 10px; font-weight: 700; color: #fff; }
.pt-dec-doc > span:nth-child(2) { flex: 1; min-width: 0; }
.pt-dec-doc b { display: block; overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.pt-dec-doc small { font-size: 11px; color: #667781; }
.pt-dec-doc .icon { width: 18px; height: 18px; color: #667781; }
.pt-dec-docmsg .bubble__time { padding-right: 6px; }
.pt-dec-compose { display: flex; gap: 8px; padding: 8px; background: #F0F2F5; }
.pt-dec-compose input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 18px; background: #fff; font: inherit; font-size: 13px; color: var(--ink); }
.pt-dec-send { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; }

/* Bastidores */
.pt-dec-steps { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pt-dec-steps h4 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.pt-dec-steps h4 .icon { align-self: center; }
.pt-dec-steps h4 small { font-size: 12px; font-weight: 400; color: var(--subtle); }
.pt-dec-steps__vazio { margin-bottom: 10px; font-size: 12.5px; color: var(--muted); }
.pt-dec-steps > ol { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.pt-dec-steps > ol li { position: relative; display: flex; gap: 10px; padding-bottom: 10px; font-size: 12.5px; color: var(--subtle); }
.pt-dec-steps > ol li:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.pt-dec-steps > ol li.is-done:not(:last-child)::before { background: var(--ink); }
.pt-dec-step__ic { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--subtle); }
.pt-dec-step__ic .icon { width: 12px; height: 12px; }
.pt-dec-steps li b { display: block; padding-top: 3px; font-weight: 600; }
.pt-dec-steps li small { display: block; margin-top: 1px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.pt-dec-steps li.is-done { color: var(--ink); }
.pt-dec-steps li.is-done .pt-dec-step__ic { border-color: var(--ink); background: var(--ink); color: #fff; }
.pt-dec-steps li.is-now { color: var(--ink); }
.pt-dec-steps li.is-now .pt-dec-step__ic { border-color: #F59E0B; color: #A35A00; animation: pt-dec-pulse 1.4s infinite; }
@keyframes pt-dec-pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .45); } 70% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } }
.pt-dec-antes { margin-top: 2px; border-top: 1px dashed var(--line-strong); padding-top: 10px; font-size: 12.5px; }
.pt-dec-antes summary { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
.pt-dec-antes summary::-webkit-details-marker { display: none; }
.pt-dec-antes summary .icon:last-child { margin-left: auto; transition: transform .2s; }
.pt-dec-antes[open] summary .icon:last-child { transform: rotate(180deg); }
.pt-dec-antes ol { margin: 8px 0 0; padding-left: 22px; color: var(--muted); }
.pt-dec-antes ol li { margin-bottom: 2px; text-decoration: line-through; text-decoration-color: var(--subtle); }
.pt-dec-antes p { margin-top: 8px; color: var(--ink); font-weight: 500; }

/* Painel */
.pt-dec-board { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.pt-dec-board .pt-col { min-height: 300px; }
.pt-dec-card { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.pt-dec-card.is-new { animation: pt-dec-in .4s ease; }
.pt-dec-card.is-static { cursor: default; opacity: .62; }
.pt-dec-card.is-static:hover { border-color: var(--line); box-shadow: none; }
.pt-dec-card.is-run { border-color: var(--ink); }
.pt-dec-card.is-run .pt-card__t::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #F59E0B; animation: pt-dec-pulse 1.4s infinite; }
@keyframes pt-dec-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pt-dec-key { font-size: 11px; font-weight: 700; color: var(--subtle); }
.pt-dec-prio { padding: 0 6px; border-radius: var(--pill); background: var(--surface-2); font-size: 10.5px; font-weight: 700; color: var(--muted); }
.pt-dec-prio--alta { background: var(--warning-bg); color: var(--warning); }

/* Conferência */
.pt-dec-back { margin-bottom: 12px; }
.pt-dec-conf h4 { margin: 6px 0 10px; font-size: 18px; font-weight: 600; color: var(--ink); outline: none; }
.pt-dec-conf h5 { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pt-dec-conf__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pt-dec-status { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: var(--pill); font-size: 11.5px; font-weight: 700; }
.pt-dec-status--warn { background: var(--warning-bg); color: var(--warning); }
.pt-dec-status--run { background: var(--surface-2); color: var(--ink); }
.pt-dec-status--ok { background: var(--success-bg); color: var(--success); }
.pt-dec-dl { max-width: 520px; }
.pt-dec-pedido { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #D9FDD3; font-size: 13px; line-height: 1.45; color: #111B21; }
.pt-dec-pedido .icon { margin-top: 2px; }
.pt-dec-alerts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pt-dec-alerts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.45; }
.pt-dec-alerts li > .icon { margin-top: 2px; color: var(--muted); }
.pt-dec-alerts li.is-warn { border-color: #F5D08A; background: #FFFBEB; }
.pt-dec-alerts li.is-warn > .icon { color: #A35A00; }
.pt-dec-alerts li > div { flex: 1; min-width: 0; }
.pt-dec-decide { display: grid; gap: 6px; margin-top: 8px; }
.pt-dec-decide label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.pt-dec-decide input { margin-top: 3px; accent-color: var(--ink); }
.pt-dec-decide small { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.pt-dec-decide small .icon { width: 12px; height: 12px; }
.pt-dec-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 16px; align-items: start; }
.pt-dec-table td small { max-width: 220px; white-space: normal; }
.pt-dec-table td:nth-child(n+2), .pt-dec-table th:nth-child(n+2) { text-align: right; }
.pt-dec-table tr.is-open td { background: #FFFBEB; }
.pt-dec-table tfoot td { border-top: 2px solid var(--line-strong); background: var(--surface); }

/* Prévia da declaração */
.pt-dec-paper { padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: var(--shadow-sm); font-size: 11.5px; line-height: 1.55; color: var(--text); }
.pt-dec-paper__lh { display: grid; gap: 1px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 2px solid var(--ink); }
.pt-dec-paper__lh b { font-size: 13px; letter-spacing: .06em; color: var(--ink); }
.pt-dec-paper__lh span { font-size: 10.5px; color: var(--muted); }
.pt-dec-paper h6 { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-align: center; color: var(--ink); }
.pt-dec-paper p { margin-bottom: 8px; }
.pt-dec-paper__m { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 16px; margin: 0 0 8px; padding: 0; list-style: none; }
.pt-dec-paper__m li { display: flex; justify-content: space-between; gap: 6px; padding: 2px 0; border-bottom: 1px dotted var(--line-strong); }
.pt-dec-paper__tot b { color: var(--ink); }
.pt-dec-paper__nota { font-size: 10.5px; color: var(--muted); }
.pt-dec-paper__sig { display: grid; justify-items: center; gap: 1px; margin: 16px auto 0; padding-top: 6px; max-width: 240px; border-top: 1px solid var(--ink); text-align: center; }
.pt-dec-paper__sig i { font-size: 10.5px; color: var(--subtle); }
.pt-dec-paper__sig.is-signed i { font-style: normal; font-weight: 700; color: var(--success); }
.pt-dec-paper__sig b { font-size: 12px; color: var(--ink); }
.pt-dec-paper__sig span { font-size: 10.5px; color: var(--muted); }

/* Ações */
.pt-dec-acts { margin-top: 16px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.pt-dec-check { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pt-dec-check input { width: 17px; height: 17px; accent-color: var(--ink); }
.pt-dec-acts .pt-actions { margin-bottom: 6px; }
.pt-dec .pt-btn[disabled] { opacity: .45; cursor: not-allowed; }
.pt-dec-ask { margin-top: 12px; }
.pt-dec-ask textarea { min-height: 72px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; font: inherit; font-size: 13.5px; font-weight: 400; line-height: 1.45; color: var(--ink); resize: vertical; }
.pt-dec-state { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.pt-dec-state .icon { margin-top: 2px; }
.pt-dec-state--warn { background: var(--warning-bg); color: var(--warning); }
.pt-dec-state--run { background: var(--surface-2); color: var(--ink); }
.pt-dec-state--run .icon { animation: pt-dec-spin 1s linear infinite; }
.pt-dec-state--ok { background: var(--success-bg); color: var(--success); }
@keyframes pt-dec-spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .pt-dec-grid { grid-template-columns: 1fr; }
  .pt-dec-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .pt-dec-right { padding: 14px; }
  .pt-dec-board { grid-template-columns: repeat(4, 200px); }
}
@media (max-width: 480px) {
  .pt-dec-left { padding: 12px; }
  .pt-dec-emp { display: none; }
  .pt-dec-msgs { height: 300px; }
  .pt-dec-dl { grid-template-columns: 1fr 1fr; }
  .pt-dec-paper { padding: 14px 12px; }
  .pt-dec-paper__m { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pt-dec *, .pt-dec *::before { animation: none !important; transition: none !important; }
}
