/* central.css — Central de Certidões, restyle fiel ao protótipo Claude Design.
 * Todo o CSS é escopado sob #view-certidoes-central para não vazar. Cores via
 * tokens --pd-* (_tokens.css); sinais de risco em paleta semântica do protótipo:
 * reprovado=vermelho, vencida=âmbar, erro/pendente=laranja, fila_humana=roxo. */

/* ---- Layout da tela ---------------------------------------------------- */
#view-certidoes-central:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 24px 40px;
    font-family: var(--pd-font);
    color: var(--pd-text);
}

/* ---- Header ------------------------------------------------------------ */
#view-certidoes-central .view-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    border: 0;
}
#view-certidoes-central .view-title {
    margin: 0 0 3px;
    font: 800 23px/1.15 var(--pd-font);
    letter-spacing: -.025em;
    color: var(--pd-text);
}
#view-certidoes-central .cc-subtitle {
    margin: 0;
    font: 500 13px/1.4 var(--pd-font);
    color: var(--pd-muted);
}
#view-certidoes-central .view-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
#view-certidoes-central #cc-refresh {
    height: 40px;
    padding: 0 16px;
    border: 1px solid #D4DAE3;
    border-radius: var(--pd-r);
    background: var(--pd-surface);
    color: var(--pd-text);
    font: 700 12.5px var(--pd-font);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
#view-certidoes-central #cc-refresh:hover {
    background: var(--pd-surface-2);
    border-color: var(--pd-brand);
    color: var(--pd-brand);
}

/* ---- Chips de resumo (contagem por sinal) ------------------------------ */
#view-certidoes-central .cc-resumo {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}
#view-certidoes-central .cc-resumo:empty { display: none; }
#view-certidoes-central .cc-resumo-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 13px;
    border: 1px solid transparent;
    border-radius: var(--pd-r-pill);
    font: 700 12px var(--pd-font);
    cursor: pointer;
    transition: filter .15s, box-shadow .15s;
}
#view-certidoes-central .cc-resumo-chip:hover { filter: brightness(.97); box-shadow: var(--pd-shadow-sm); }
#view-certidoes-central .cc-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: var(--pd-r-pill);
    font: 800 10px var(--pd-mono);
    color: #fff;
}
#view-certidoes-central .cc-resumo-empty {
    font: 600 12.5px var(--pd-font);
    color: var(--pd-muted);
}

/* ---- Filtros ----------------------------------------------------------- */
#view-certidoes-central .cc-filtros {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
#view-certidoes-central .cc-filtros select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #D4DAE3;
    border-radius: var(--pd-r);
    background: var(--pd-surface);
    color: var(--pd-text);
    font: 700 12.5px var(--pd-font);
    cursor: pointer;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
#view-certidoes-central .cc-filtros select:focus {
    border-color: var(--pd-brand);
    box-shadow: 0 0 0 3px var(--pd-brand-soft);
}
#view-certidoes-central .cc-filtros select.hidden { display: none; }

/* ---- Card da tabela ---------------------------------------------------- */
#view-certidoes-central .cc-table-wrap {
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 16px;
    box-shadow: var(--pd-shadow-sm);
    overflow-x: auto;
}
#view-certidoes-central table.custos-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

/* thead */
#view-certidoes-central table.custos-table thead th {
    text-align: left;
    padding: 12px 10px;
    background: var(--pd-surface-2);
    border: 0;
    font: 700 9.5px var(--pd-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pd-muted);
    white-space: nowrap;
}
#view-certidoes-central table.custos-table thead th:first-child { padding-left: 20px; }
#view-certidoes-central table.custos-table thead th:last-child  { padding-right: 20px; }
/* Emissão / Validade / Status centralizados; Ação à direita */
#view-certidoes-central table.custos-table thead th:nth-child(6),
#view-certidoes-central table.custos-table thead th:nth-child(7),
#view-certidoes-central table.custos-table thead th:nth-child(8) { text-align: center; }
#view-certidoes-central table.custos-table thead th:nth-child(10) { text-align: right; }

/* linhas */
#view-certidoes-central table.custos-table tbody td {
    padding: 13px 10px;
    border: 0;
    border-top: 1px solid var(--pd-border);
    font: 600 12px var(--pd-font);
    color: var(--pd-text-2);
    vertical-align: middle;
    white-space: nowrap;
}
#view-certidoes-central table.custos-table tbody td:first-child { padding-left: 17px; }
#view-certidoes-central table.custos-table tbody td:last-child  { padding-right: 20px; }
#view-certidoes-central table.custos-table tbody td:nth-child(6),
#view-certidoes-central table.custos-table tbody td:nth-child(7),
#view-certidoes-central table.custos-table tbody td:nth-child(8) {
    text-align: center;
    color: var(--pd-muted);
    font-weight: 600;
}
#view-certidoes-central table.custos-table tbody td:last-child {
    text-align: right;
}
#view-certidoes-central table.custos-table tbody tr:hover td {
    background: var(--pd-surface-2);
}

/* barra-bandeira à esquerda das linhas sinalizadas */
#view-certidoes-central table.custos-table tbody tr.cc-row-sinal td:first-child {
    border-left: 3px solid var(--pd-muted);
    padding-left: 14px;
}
#view-certidoes-central tr.cc-row-reprovado    td:first-child { border-left-color: var(--pd-accent); }
#view-certidoes-central tr.cc-row-vencida      td:first-child { border-left-color: var(--pd-gold); }
#view-certidoes-central tr.cc-row-erro_pendente td:first-child { border-left-color: #E67E22; }
#view-certidoes-central tr.cc-row-fila_humana  td:first-child { border-left-color: var(--pd-purple); }

/* ---- Badge de sinal de risco (coluna Sinal + Resultado) ---------------- */
#view-certidoes-central .cc-sinal {
    display: inline-flex;
    align-items: center;
    font: 800 10px var(--pd-font);
    letter-spacing: .02em;
    padding: 4px 11px;
    border-radius: var(--pd-r-pill);
    white-space: nowrap;
}
#view-certidoes-central .cc-sinal-none { color: var(--pd-faint); font-weight: 600; }

/* reprovado — vermelho */
#view-certidoes-central .cc-sinal-reprovado { color: var(--pd-accent); background: var(--pd-accent-soft); }
#view-certidoes-central .cc-chip-reprovado  { color: var(--pd-accent); background: var(--pd-accent-soft); }
#view-certidoes-central .cc-chip-reprovado .cc-chip-count { background: var(--pd-accent); }
/* vencida — âmbar/dourado */
#view-certidoes-central .cc-sinal-vencida { color: var(--pd-gold); background: rgba(194,121,12,.13); }
#view-certidoes-central .cc-chip-vencida  { color: var(--pd-gold); background: rgba(194,121,12,.13); }
#view-certidoes-central .cc-chip-vencida .cc-chip-count { background: var(--pd-gold); }
/* pendente/erro — laranja */
#view-certidoes-central .cc-sinal-erro_pendente { color: #C15C10; background: rgba(230,126,34,.14); }
#view-certidoes-central .cc-chip-erro_pendente  { color: #C15C10; background: rgba(230,126,34,.14); }
#view-certidoes-central .cc-chip-erro_pendente .cc-chip-count { background: #E67E22; }
/* fila humana — roxo */
#view-certidoes-central .cc-sinal-fila_humana { color: var(--pd-purple); background: rgba(124,77,214,.14); }
#view-certidoes-central .cc-chip-fila_humana  { color: var(--pd-purple); background: rgba(124,77,214,.14); }
#view-certidoes-central .cc-chip-fila_humana .cc-chip-count { background: var(--pd-purple); }

/* ---- Célula do imóvel (link → gestão) ---------------------------------- */
#view-certidoes-central .cc-imovel-link {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-decoration: none;
}
#view-certidoes-central .cc-imovel-titulo {
    order: 1;
    font: 700 12px var(--pd-font);
    color: var(--pd-brand);
    text-decoration: underline;
    text-decoration-color: #D4DAE3;
    text-underline-offset: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
}
#view-certidoes-central .cc-imovel-codigo {
    order: 2;
    font: 600 10.5px var(--pd-mono);
    color: var(--pd-muted-2);
}
#view-certidoes-central .cc-imovel-codigo::before { content: "#"; }
#view-certidoes-central .cc-imovel-link:hover .cc-imovel-titulo { text-decoration-color: var(--pd-brand); }

/* ---- Célula pessoa (nome + CPF mono) ----------------------------------- */
#view-certidoes-central .cc-pessoa {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}
#view-certidoes-central .cc-pessoa-nome { font: 700 12px var(--pd-font); color: var(--pd-text-2); }
#view-certidoes-central .cc-pessoa-cpf  { font: 600 10.5px var(--pd-mono); color: var(--pd-muted-2); }

/* ---- Célula corretor (avatar + nome) ----------------------------------- */
#view-certidoes-central .cc-corretor {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
#view-certidoes-central .cc-avatar {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 50%;
    background: rgba(91,107,130,.15);
    color: var(--pd-muted-2);
    font: 800 9px var(--pd-font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#view-certidoes-central .cc-corretor-nome { font: 600 11.5px var(--pd-font); color: var(--pd-text-2); }

/* ---- Arquivo / links --------------------------------------------------- */
#view-certidoes-central table.custos-table tbody td a[href] {
    color: var(--pd-brand);
    font-weight: 700;
    text-decoration: none;
}
#view-certidoes-central table.custos-table tbody td a[href]:hover { text-decoration: underline; }
#view-certidoes-central .cc-link-morto {
    color: var(--pd-faint);
    font: 600 11.5px var(--pd-font);
    font-style: italic;
}

/* ---- Botão Resolver manualmente ---------------------------------------- */
#view-certidoes-central .cc-resolver-manual {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: none;
    border-radius: var(--pd-r-sm);
    background: var(--pd-brand);
    color: #fff;
    font: 700 11px var(--pd-font);
    cursor: pointer;
    transition: filter .15s;
}
#view-certidoes-central .cc-resolver-manual:hover { filter: brightness(1.08); }

/* ---- Estado vazio ------------------------------------------------------ */
#view-certidoes-central #cc-empty {
    padding: 40px 18px;
    text-align: center;
    font: 600 13px var(--pd-font);
    color: var(--pd-muted-2);
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 16px;
    box-shadow: var(--pd-shadow-sm);
}
#view-certidoes-central #cc-empty.hidden { display: none; }
