/* Meu XML — documentos fiscais. */

.documents-toolbar{display:flex;flex-wrap:wrap;gap:var(--sp-3)}
.documents-toolbar>.search{flex:1 1 280px}
.documents-toolbar>#docCompany{flex:1 1 200px;width:auto}
.documents-toolbar>#docType{flex:0 1 170px;width:auto}
.documents-toolbar>.date-range{flex:0 1 300px}
.documents-toolbar>button{flex:0 0 auto}

/* Período: um campo só com início e fim */
.date-range{display:flex;align-items:center;gap:var(--sp-2);min-width:0;min-height:var(--control-h);padding:0 var(--sp-3);border:1px solid var(--line-strong);border-radius:var(--r-md);background:var(--surface);color:var(--muted)}
.date-range:focus-within{border-color:var(--accent);box-shadow:var(--focus)}
.date-range-sep{color:var(--subtle)}
.date-filter{position:relative;display:flex;flex:0 1 auto;align-items:center;min-width:0;min-height:calc(var(--control-h) - 2px);color:var(--muted);font-size:var(--fs-md);font-weight:500;cursor:pointer}
.date-filter.has-value .date-filter-text{color:var(--text);font-weight:700}
.date-filter-text{white-space:nowrap}
.calendar-icon{flex:0 0 18px;width:18px;height:18px}
.calendar-icon svg,.document-filter-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.date-filter input{position:absolute;inset:0;z-index:1;width:100%;height:100%;min-height:0;padding:0;border:0;opacity:.001;cursor:pointer}
.document-results-actions{display:flex;align-items:center;gap:var(--sp-4)}
.document-results-actions .batch-download{min-height:36px;padding:6px 14px;font-size:var(--fs-sm)}
.document-filter-button.clear-filters{background:var(--surface);color:var(--text);border-color:var(--line-strong)}

/* Tabela */
#page-documents .table-wrap>table{min-width:1120px;table-layout:fixed}
#page-documents th,#page-documents td{padding-left:var(--sp-3);padding-right:var(--sp-3)}
#page-documents th:first-child,#page-documents td:first-child{padding-left:var(--sp-5)}
#page-documents th:last-child,#page-documents td:last-child{padding-right:var(--sp-5)}
#page-documents th:nth-child(1){width:92px}
#page-documents th:nth-child(3){width:130px}
#page-documents th:nth-child(4){width:196px}
#page-documents th:nth-child(5){width:136px}
#page-documents th:nth-child(6){width:124px}
#page-documents th:nth-child(7){width:148px}
#page-documents th:nth-child(8){width:200px}
#page-documents th:nth-child(6),#page-documents td:nth-child(6){text-align:right}
#page-documents td:nth-child(2){overflow-wrap:anywhere}
#page-documents td:nth-child(5),#page-documents td:nth-child(6){white-space:nowrap;font-variant-numeric:tabular-nums}
.document-amount{font-weight:700}
.document-sort{display:inline-flex;align-items:center;gap:6px;color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit}
.document-sort svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}

.xml-summary-row>td{background:var(--surface-2)}
.xml-state-label{color:var(--amber);font-size:var(--fs-xs);font-weight:600;line-height:1.35}

.document-key{display:flex;align-items:center;gap:var(--sp-2)}
.document-key-digits{display:flex;flex-direction:column;font-family:var(--font-mono);font-size:10.5px;line-height:15px;color:var(--muted);user-select:all}
.document-key-copy{display:inline-grid;place-items:center;flex:none;width:30px;height:30px;border-radius:var(--r-sm);background:var(--surface-3);color:var(--text)}
.document-key-copy:hover{background:var(--line)}
.document-key-copy svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

.document-actions{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-end;gap:6px}
.document-actions>button{min-height:34px;padding:6px 10px;font-size:var(--fs-sm);border-radius:var(--r-sm)}
.document-actions svg{width:15px;height:15px}
/* Coluna Manifestação: selo, botão ou traço, sempre no mesmo lugar */
.document-manifestation{white-space:nowrap}
.manifestation-recorded{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:3px 10px 3px 8px;border:1px solid var(--green-line);border-radius:999px;background:var(--green-bg);color:var(--green);font-size:var(--fs-xs);font-weight:700;cursor:default}
.manifestation-recorded svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.document-manifestation .manifestation-button{min-height:30px;padding:4px 14px;border-color:var(--accent);border-radius:999px;color:var(--accent-text);font-size:var(--fs-xs);font-weight:700}
.document-manifestation .manifestation-button:hover{background:var(--accent-soft)}
.manifestation-none{color:var(--subtle)}
.xml-request{min-height:34px;padding:6px 10px;border-color:var(--amber-line);background:var(--amber-bg);color:var(--amber);font-size:var(--fs-xs);white-space:normal;text-align:center;border-radius:var(--r-sm)}
.xml-request.waiting{border-color:var(--line);background:var(--surface);color:var(--muted)}
.xml-request:disabled{cursor:wait;opacity:.7}
.mobile-document-details{display:none}
.document-date-short{display:none}

/* Manifestação do destinatário */
.manifestation-dialog{width:min(680px,calc(100vw - 32px))}
.manifestation-options{display:grid;gap:var(--sp-3);padding:0;border:0}
.manifestation-options label{display:flex;flex-direction:row;align-items:flex-start;gap:var(--sp-3);padding:var(--sp-4);border:1px solid var(--line);border-radius:var(--r-lg);font-weight:500;cursor:pointer}
.manifestation-options label:has(input:checked){border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent);background:var(--accent-soft)}
.manifestation-options input{margin-top:2px}
.manifestation-options strong,.manifestation-options small{display:block}
.manifestation-options small{margin-top:2px;color:var(--muted)}
.manifestation-history{padding-top:var(--sp-4);border-top:1px solid var(--line)}
.manifestation-history h3{margin:0 0 var(--sp-2);font-size:var(--fs-md)}
.manifestation-history article{display:grid;gap:2px;padding:var(--sp-3);border-radius:var(--r-md);background:var(--surface-2)}
.manifestation-history article+article{margin-top:var(--sp-2)}
.manifestation-history article span,.manifestation-history article small{color:var(--muted);font-size:var(--fs-xs)}

/* Celular: cada documento vira um cartão */
@media (max-width:720px){
  .documents-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-2)}
  .documents-toolbar>.search,.documents-toolbar>#docCompany,.documents-toolbar>.date-range{grid-column:1/-1}
  #page-documents .document-results-actions{width:100%;justify-content:space-between}
  .documents-toolbar>button{font-size:var(--fs-md)}
  #page-documents>.panel{border:0;background:transparent;box-shadow:none}
  #page-documents>.panel>.panel-title{padding:0;margin-bottom:var(--sp-3)}
  #page-documents>.panel>.panel-title .eyebrow{display:none}
  #page-documents .table-wrap{overflow:visible}
  #page-documents .table-wrap>table{display:block;min-width:0;table-layout:auto}
  #page-documents thead{display:none}
  /* Lista em linhas: empresa e valor em cima; tipo, número, data, manifestação e arquivos embaixo */
  #documentsBody{display:block;border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface);overflow:hidden}
  #documentsBody tr{display:grid;grid-template-columns:auto auto minmax(0,1fr) auto auto;align-items:center;gap:4px 8px;padding:10px var(--sp-3);border-bottom:1px solid var(--line)}
  #documentsBody tr:last-child{border-bottom:0}
  #documentsBody tr.xml-summary-row{background:var(--surface-2)}
  #documentsBody td{display:block;min-width:0;padding:0;border:0;background:transparent;font-size:var(--fs-xs)}
  #page-documents #documentsBody td{padding:0}
  #documentsBody td:nth-child(2){grid-column:1/4;grid-row:1;overflow:hidden}
  #documentsBody td:nth-child(2)>strong{display:block;overflow:hidden;font-size:var(--fs-sm);white-space:nowrap;text-overflow:ellipsis}
  #documentsBody td:nth-child(2)>.sub{display:none}
  #documentsBody td:nth-child(6){grid-column:5;grid-row:1;text-align:right;font-size:var(--fs-sm);white-space:nowrap}
  #documentsBody td:nth-child(1){grid-column:1;grid-row:2}
  #documentsBody td:nth-child(1) .doc-type{padding:0;background:transparent;border:0;font-size:var(--fs-xs)}
  #documentsBody td:nth-child(1) .doc-type i{display:none}
  #documentsBody td:nth-child(3){position:relative;grid-column:2;grid-row:2;color:var(--muted);white-space:nowrap}
  #documentsBody td:nth-child(3)>strong{font-weight:500;text-decoration:underline dotted;text-underline-offset:3px}
  #documentsBody td:nth-child(3)>strong::before{content:"· ";color:var(--subtle);display:inline-block;margin-right:4px;text-decoration:none}
  #documentsBody td:nth-child(3)>.sub{display:none}
  #documentsBody td:nth-child(5){grid-column:3;grid-row:2;overflow:hidden;color:var(--muted);white-space:nowrap;text-overflow:ellipsis}
  #documentsBody td:nth-child(5)::before{content:"· ";color:var(--subtle)}
  #documentsBody td:nth-child(7){grid-column:4;grid-row:1;justify-self:end}
  #documentsBody td:nth-child(7):has(.manifestation-none){display:none}
  #documentsBody td:nth-child(8){grid-column:4/6;grid-row:2;display:flex;justify-content:flex-end}
  #documentsBody td:nth-child(4){display:none;grid-column:1/-1;grid-row:3;padding-top:6px}
  #documentsBody tr.mobile-key-open td:nth-child(4){display:block}
  #documentsBody td[colspan]{grid-column:1/-1;grid-row:auto;padding:var(--sp-3);font-size:var(--fs-sm)}
  /* Selo vira só o ✔; Manifestar fica pequeno */
  #documentsBody .manifestation-recorded{width:22px;height:22px;min-height:0;padding:0;justify-content:center;font-size:0;gap:0}
  #documentsBody .manifestation-recorded svg{width:13px;height:13px}
  #documentsBody .document-manifestation .manifestation-button{min-height:24px;padding:1px 9px;font-size:10.5px}
  /* Arquivos: XML e PDF pequenos, só texto */
  #documentsBody .document-actions{gap:4px}
  #documentsBody .document-actions>button{min-height:30px;padding:4px 9px;font-size:11px}
  #documentsBody .document-actions svg{display:none}
  #documentsBody .xml-request{min-height:0;max-width:110px;padding:3px 8px;font-size:10.5px;line-height:1.25}
  /* Tocar no número mostra a chave de acesso */
  #documentsBody .mobile-document-details{position:absolute;inset:-8px -4px;display:block;min-height:0;padding:0;border:0;background:transparent;font-size:0;color:transparent}
  .document-date-full{display:none}
  .document-date-short{display:inline}
  #documentsBody tr:hover>td{background:transparent}
  #documentPagination{padding:var(--sp-4) 0;border-top:0}
  #documentPagination>span{flex-basis:100%}
}
