/* =====================================================================
 * tc-cadastro.css -- Padrao visual das telas de CADASTRO (core v1.157.0)
 *
 * Nasceu no Cadastro de Produto / Clientes / Configuracao do Sistema
 * (tc-produto.css, 25/10/2026) e foi promovido a padrao de TODAS as telas
 * de cadastro em 05/11/2026. Carregado em TODA pagina pelo config/dz.php
 * (global css), antes do moderno.css -- a tela nao precisa incluir nada.
 *
 *   .tcp-acc / .tcp-acc-item / .tcp-acc-head / .tcp-acc-body
 *        accordion em cartoes independentes, cabecalho com icone + titulo
 *        + subtitulo-resumo (helper PHP tcAccHead(), elements/funcoes.php)
 *   .tcp-sub-h      subtitulo com filete dentro de uma secao
 *   .tcp-seg-wrap   segmentado Sim/Nao (espelho do select ativo_inativo;
 *                   o JS esta em assets/js/tc-cadastro.js, automatico)
 *   .tcp-flag-tile  cartao de flag (helper tcFlag())
 *   .tcp-toolbar / .tcp-form-bottom   barras de botoes do form
 *   .tc-cad-modal   modal de cadastro: cabecalho com icone, subtitulo e
 *                   numero do registro (helper tcModalHead())
 *
 * Doc: docsclaude/padrao_visual_cadastros.md. Prefixo tcp- (historico) e
 * tc-cad- (novo). Cores SO pelos tokens do titan.css: o html.dark troca os
 * tokens e esta folha acompanha; onde ha cor fixa, ha bloco html.dark.
 * ===================================================================== */

/* ---------- Accordions do form (cartoes independentes) ---------- */
.tcp-acc { display: flex; flex-direction: column; gap: 12px; }
.tcp-acc-item {
    background: var(--tc-surface); border-radius: var(--tc-radius-lg, 16px);
    box-shadow: var(--tc-shadow); overflow: hidden;
}
.tcp-acc-head {
    width: 100%; border: 0; background: color-mix(in srgb, var(--tc-accent) 9%, transparent);
    color: var(--tc-on-surface); display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; text-align: left; min-height: 62px; cursor: pointer;
}
html.dark .tcp-acc-head { background: rgba(255,255,255,.05); }
.tcp-acc-head:focus-visible { outline: 2px solid var(--tc-accent); outline-offset: -2px; }
.tcp-acc-head .tcp-ic {
    width: 36px; height: 36px; border-radius: 10px; background: var(--tc-surface);
    display: grid; place-items: center; color: var(--tc-accent); flex: 0 0 36px; box-shadow: var(--tc-shadow-sm);
}
.tcp-acc-head .tcp-tx { min-width: 0; flex: 1; }
.tcp-acc-head .tcp-tt { font-weight: 700; font-size: 14.5px; display: block; }
.tcp-acc-head .tcp-sm {
    font-size: 12px; color: var(--tc-muted); display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tcp-acc-head .tcp-chev {
    width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform .2s; flex: 0 0 auto; margin-right: 4px;
}
.tcp-acc-head:not(.collapsed) .tcp-chev { transform: rotate(45deg); }
.tcp-acc-body { padding: 20px 24px; }
@media (max-width: 575.98px) {
    .tcp-acc-body { padding: 16px; }
    .tcp-acc-head { padding: 12px 14px; gap: 10px; }
}

/* Subtitulo com filete */
.tcp-sub-h {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--tc-muted);
    font-weight: 700; margin: 18px 0 10px; display: flex; align-items: center; gap: 8px;
}
.tcp-sub-h::after { content: ''; flex: 1; height: 1px; background: var(--tc-outline); }
.tcp-sub-h:first-child { margin-top: 0; }
.tcp-linkish { background: none; border: 0; padding: 0; color: var(--tc-accent); font-size: 12.5px; font-weight: 600; }
.tcp-linkish:disabled { color: var(--tc-muted); }
.tcp-hint { font-size: 11px; color: var(--tc-muted); margin-top: 3px; }

/* Barra do topo e do fim do form */
.tcp-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tc-page-header .tcp-toolbar { justify-content: flex-end; }
.tcp-form-bottom {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;
    padding: 14px 0; border-top: 1px solid var(--tc-outline); flex-wrap: wrap;
}

/* ---------- Segmentado Sim/Nao (espelho visual do select ativo_inativo) ---------- */
/* O select some da vista mas continua FOCAVEL: campo required vazio ainda mostra o
   balao de validacao (display:none deixava o submit abortar calado). */
.tcp-seg-wrap { position: relative; }
.tcp-seg-wrap select.tcp-seg-src {
    position: absolute; left: 12px; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0;
    opacity: 0; pointer-events: none;
}
.tcp-seg {
    display: flex; background: var(--tc-surface-low); border: 1px solid var(--tc-outline);
    border-radius: 9px; padding: 2px; width: 100%;
}
.tcp-seg button {
    flex: 1; border: 0; background: transparent; text-align: center; font-size: 12.5px; font-weight: 600;
    padding: 5px 8px; border-radius: 7px; color: var(--tc-muted); white-space: nowrap;
}
.tcp-seg button[aria-pressed="true"] { background: var(--tc-surface); color: var(--tc-on-surface); box-shadow: var(--tc-shadow-sm); }
.tcp-seg button.tcp-y[aria-pressed="true"] { color: var(--tc-success); }
.tcp-seg button:focus-visible { outline: 2px solid var(--tc-accent); outline-offset: 1px; }
.tcp-seg button:disabled { cursor: not-allowed; opacity: .6; }
.tcp-flag-tile {
    border: 1px solid var(--tc-outline); border-radius: 12px; padding: 10px 12px;
    height: 100%; background: var(--tc-surface);
}
.tcp-flag-tile .form-label { font-size: 12.5px; font-weight: 700; color: var(--tc-on-surface); }
.tcp-flag-tile .tcp-d { font-size: 11.5px; color: var(--tc-muted); margin-top: 8px; }
.tcp-flag-tile .tcp-def { font-size: 10.5px; color: var(--tc-accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }

/* Checkbox do renderField('checkbox') dentro de cadastro: vira cartao clicavel,
   destacado quando marcado (mesma linguagem do cartao de flag). */
.tcp-acc-body [class*="col"] > .form-check.mt-2,
.tc-cad-modal .modal-body [class*="col"] > .form-check.mt-2 {
    border: 1px solid var(--tc-outline); border-radius: 10px; background: var(--tc-surface);
    padding: 8px 12px; min-height: 38px; display: flex; align-items: center; gap: 8px; margin-bottom: 0;
}
.tcp-acc-body [class*="col"] > .form-check.mt-2 .form-check-input,
.tc-cad-modal .modal-body [class*="col"] > .form-check.mt-2 .form-check-input { float: none; margin: 0; flex: 0 0 auto; }
.tcp-acc-body [class*="col"] > .form-check.mt-2 .form-check-label,
.tc-cad-modal .modal-body [class*="col"] > .form-check.mt-2 .form-check-label { font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tcp-acc-body [class*="col"] > .form-check.mt-2:has(.form-check-input:checked),
.tc-cad-modal .modal-body [class*="col"] > .form-check.mt-2:has(.form-check-input:checked) {
    border-color: color-mix(in srgb, var(--tc-accent) 55%, transparent);
    background: color-mix(in srgb, var(--tc-accent) 8%, transparent);
}

/* ---------- Modais de cadastro (cabecalho com icone) ---------- */
.tcp-modal .modal-title,
.tc-cad-modal .tc-cad-mhead { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tcp-modal .modal-title .tcp-mic,
.tc-cad-modal .tcp-mic {
    width: 32px; height: 32px; border-radius: 9px; background: color-mix(in srgb, var(--tc-accent) 12%, transparent);
    color: var(--tc-accent); display: grid; place-items: center; font-size: 14px; flex: 0 0 32px;
}
.tcp-modal .modal-title .tcp-mt, .tc-cad-modal .tcp-mt { min-width: 0; }
.tcp-modal .modal-title small,
.tc-cad-modal .tcp-mt small {
    display: block; font-size: 12px; color: var(--tc-muted); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tcp-modal .modal-footer .tcp-foot { font-size: 11.5px; color: var(--tc-muted); margin-right: auto; }
.tc-cad-modal .modal-content { border-radius: var(--tc-radius-lg, 16px); overflow: hidden; }
.tc-cad-modal .modal-header {
    background: color-mix(in srgb, var(--tc-accent) 7%, transparent);
    border-bottom: 1px solid var(--tc-outline); padding: 14px 20px; gap: 10px;
}
html.dark .tc-cad-modal .modal-header { background: rgba(255,255,255,.04); }
.tc-cad-modal .tc-cad-mhead { flex: 1; }
.tc-cad-modal .tc-cad-mhead .modal-title {
    font-size: 16px; font-weight: 700; margin: 0; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-cad-modal .tc-cad-mtl { display: flex; align-items: center; min-width: 0; }
.tc-cad-modal .tc-cad-mhead .tc-hash-id { margin-left: 6px; font-size: 11px; vertical-align: 2px; }
.tc-cad-modal .tc-cad-mhead .tc-hash-id:empty { display: none; }
.tc-cad-modal .modal-body { padding: 18px 20px; }
.tc-cad-modal .modal-body .tcp-sub-h:first-child { margin-top: 0; }
.tc-cad-modal .modal-footer { border-top: 1px solid var(--tc-outline); padding: 10px 20px; }
@media (max-width: 575.98px) {
    .tc-cad-modal .modal-header { padding: 12px 14px; }
    .tc-cad-modal .modal-body { padding: 14px; }
}
/* Fechar (X) do Bootstrap e uma imagem escura: no escuro sumia no cabecalho. */
html.dark .tc-cad-modal .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
