/* ============================================================
   Contador One — Cadastro de Vínculos · estilos do módulo
   (carregado dentro do Portal; reusa os tokens de colors_and_type)
   ============================================================ */

/* navegação (sub-barra abaixo do topo) */
.cad-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 62px; z-index: 30; }
.cad-nav-wrap { padding: 7px 20px 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.cad-nav-wrap::-webkit-scrollbar { display: none; }
.cad-tab {
  position: relative; white-space: nowrap;
  background: none; border: 0; font-family: inherit;
  padding: 10px 15px 12px; font-size: 14px; font-weight: 600; letter-spacing: -0.006em;
  color: var(--fg-muted); border-radius: var(--radius-sm, 6px) var(--radius-sm, 6px) 0 0;
  cursor: pointer;
  transition: color .18s cubic-bezier(.2,.8,.2,1), background-color .18s cubic-bezier(.2,.8,.2,1);
}
.cad-tab::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -1px; height: 2.5px;
  background: var(--brand); border-radius: 3px 3px 0 0;
  transform: scaleX(0); transform-origin: center;
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.cad-tab:hover { color: var(--ink); background: var(--bg-muted); }
.cad-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(250,100,0,.32); }
.cad-tab.on { color: var(--brand); background: rgba(250,100,0,.08); }
.cad-tab.on:hover { background: rgba(250,100,0,.12); }
.cad-tab.on::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .cad-tab, .cad-tab::after { transition: none; } }

.cad-view { max-width: 1760px; margin: 0 auto; padding: 28px 40px 80px; }
.cad-view.hidden { display: none !important; }
.cad-wrap { display: block; }
.cad-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.cad-head h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
.cad-head p { font-size: 14px; color: var(--fg-muted); margin: 7px 0 0; max-width: 640px; line-height: 1.5; }

.cad-search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 16px; max-width: 460px; }
.cad-search svg { color: var(--fg-subtle); flex: none; }
.cad-search input { border: 0; background: none; outline: none; font-family: inherit; font-size: 14px; color: var(--fg); width: 100%; }

/* ----- estilos antes herdados do Portal, agora próprios do módulo -----
   (escopados em .cad-wrap p/ não colidir com o .panel/.tbl do Patrimônio) */
.cad-wrap .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.cad-wrap table.users { width: 100%; border-collapse: collapse; }
.cad-wrap table.users th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-subtle); padding: 12px 22px; border-bottom: 1px solid var(--border); background: var(--c1-cinza-50); white-space: nowrap; }
.cad-wrap table.users td { padding: 14px 22px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--fg); vertical-align: middle; }
.cad-wrap table.users tr:last-child td { border-bottom: 0; }
.cad-wrap table.users tbody tr:hover td { background: var(--c1-cinza-50); }
.cad-wrap .u-name { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 11px; }
.cad-wrap .u-name .av { width: 32px; height: 32px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; }
.cad-wrap .u-email { font-size: 12px; color: var(--fg-subtle); font-weight: 400; }
.cad-wrap .section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-subtle); margin: 34px 0 16px; display: flex; align-items: center; gap: 10px; }
.cad-wrap .section-label:first-child { margin-top: 0; }
.cad-wrap .section-label .ln { height: 1px; background: var(--border); flex: 1; }
.cad-wrap .gp-card .ph { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.cad-wrap .gp-card .ph h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--ink); }

/* tabela reusa .panel/.users do portal */
.cad-view tr[data-open] { cursor: pointer; }
.av { display: grid; place-items: center; }
.tagp { display: inline-block; font-size: 12px; font-weight: 600; color: var(--c1-azul-escuro); background: var(--info-bg); padding: 2px 9px; border-radius: var(--radius-pill); text-transform: capitalize; }
.st-badge { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: var(--radius-xs); vertical-align: middle; margin-left: 6px; }
.st-badge.esp { background: var(--warning-bg); color: #8a6d1f; }
.st-badge.fal { background: var(--c1-cinza-100, #e7e7e7); color: var(--fg-muted); }

.mini-avs { display: flex; gap: -6px; }
.mini-av { width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 10.5px; display: inline-grid; place-items: center; flex: none; border: 2px solid var(--surface); margin-left: -6px; }
.mini-avs .mini-av:first-child { margin-left: 0; }

/* ficha em TELA INTEIRA (antes era um drawer lateral) */
.cad-overlay { position: fixed; inset: 0; background: rgba(38,38,38,.42); opacity: 0; visibility: hidden; transition: opacity .25s; z-index: 70; }
.cad-overlay.show { opacity: 1; visibility: visible; }
.cad-drawer { position: fixed; top: 58px; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; background: var(--bg-soft); box-shadow: none; opacity: 0; visibility: hidden; transform: translateY(10px); transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .2s; z-index: 71; display: flex; flex-direction: column; }
.cad-drawer.show { transform: none; opacity: 1; visibility: visible; }
.cad-dh { padding: 16px 40px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); flex: none; }
.cad-dh-name { font-size: 20px; font-weight: 700; color: var(--ink); }
.cad-dh-sub { font-size: 13px; color: var(--fg-muted); margin-top: 3px; }
.cad-db { padding: 26px 40px 70px; overflow: auto; flex: 1; }
.cad-db-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; align-content: start; width: 100%; }
.cad-db-grid .cad-sec { grid-column: span 6; margin-bottom: 0; }
.cad-db-solo { max-width: 560px; margin: 0 auto; width: 100%; }
@media (max-width: 920px) { .cad-db-grid .cad-sec { grid-column: span 12; } }
@media (max-width: 760px) { .cad-dh, .cad-db { padding-left: 18px; padding-right: 18px; } }

.cad-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow-xs); }
.cad-sec-h { margin-bottom: 12px; }
.cad-sec-h h3 { font-size: 14px; font-weight: 700; margin: 0; color: var(--ink); }
.cad-sec-h p { font-size: 12.5px; color: var(--fg-subtle); margin: 4px 0 0; line-height: 1.45; }

.muted { color: var(--fg-subtle); font-size: 13px; }

/* chips de acesso */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 6px 5px 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.chip .mini-av { width: 22px; height: 22px; border: 0; margin: 0; }
.chip button { border: 0; background: none; color: var(--fg-subtle); font-size: 17px; line-height: 1; padding: 0 4px; cursor: pointer; }
.chip button:hover { color: var(--danger); }

/* linhas de vínculo / societário */
.vlist { display: flex; flex-direction: column; gap: 2px; }
.vrow { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.vrow:last-child { border-bottom: 0; }
.vrel { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: var(--c1-laranja-50); padding: 3px 9px; border-radius: var(--radius-pill); flex: none; }
.vname { flex: 1; font-size: 13.5px; color: var(--ink); font-weight: 500; line-height: 1.35; }
.vx { border: 0; background: none; color: var(--fg-subtle); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; flex: none; }
.vx:hover { color: var(--danger); }
.srctag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c1-verde); background: var(--success-bg); padding: 1px 6px; border-radius: var(--radius-xs); }

/* Societário: dois grids (declaração x manual) lado a lado em tela inteira */
.cad-db-grid .cad-sec.soc-sec { grid-column: span 12; }
.soc-sub { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.soc-sub .srctag { flex: none; }
.soc-sub .srctag.manual { color: var(--brand); background: var(--c1-laranja-50); }
.soc-sub-h { font-size: 12.5px; color: var(--fg-subtle); }
.soc-grid td.soc-yr { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg-muted); padding: 10px 12px; white-space: nowrap; }
.soc-grid td.soc-doc { font-family: var(--font-mono, monospace); font-size: 12px; color: var(--fg-muted); padding: 10px 12px; white-space: nowrap; }
.soc-grid td:not([class]) { padding: 10px 12px; font-size: 13px; color: var(--ink); }
.soc-grid td.num { padding: 10px 12px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* linhas de adicionar */
.add-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-row select, .add-row input { font-family: inherit; font-size: 13.5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--fg); }
.add-row select { flex: 1; min-width: 120px; }
.add-row .btn { white-space: nowrap; }
.add-mid { font-size: 13px; color: var(--fg-muted); }
.add-soc input { flex: 1; min-width: 90px; }
.add-soc .pct { flex: none; width: 64px; }

/* Vínculos: grupos + quadro */
.gp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; margin-bottom: 8px; }
.gp-card .ph { padding: 14px 18px; }
.gp-card .ph h3 { font-size: 15px; }
.gp-body { padding: 4px 18px 14px; }
.gp-row { padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.gp-row:last-child { border-bottom: 0; }
.gp-row:hover .gp-name { color: var(--brand); }
.gp-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.gp-rels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rel-chip { font-size: 11.5px; color: var(--fg-muted); background: var(--bg-soft); border: 1px solid var(--border); padding: 2px 9px; border-radius: var(--radius-pill); }
.soc-chip { font-size: 11.5px; font-weight: 600; color: var(--c1-azul-escuro); background: var(--info-bg); padding: 2px 9px; border-radius: var(--radius-pill); }

.field { margin-bottom: 14px; }
.field.hidden { display: none; }

@media (max-width: 820px) {
  .cad-nav-wrap, .cad-view { padding-left: 18px; padding-right: 18px; }
  .cad-nav { top: 56px; }
  .gp-grid { grid-template-columns: 1fr; }
}
