/* Clientes, ficha do cliente e componentes comuns aos novos módulos.
   Reutiliza os tokens de main.css e os componentes de contracts.css. */
.heading-button { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-height: 42px; }
.heading-button .icon { width: 16px; height: 16px; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Indicadores */
.module-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.module-metrics > div:last-child strong { color: inherit; }
.module-metrics .metric-warning strong { color: var(--amber); }
.module-metrics .metric-danger strong { color: #b03346; }

/* Pendências de alteração em destaque */
.pending-strip { margin-bottom: 26px; border-color: #ead6ae; }
.pending-strip .panel-heading { padding: 20px 24px; border-bottom: 1px solid #f0e4c9; background: #fffcf5; align-items: flex-start; }
.pending-strip h2 { display: flex; align-items: center; gap: 9px; font-size: 16px; letter-spacing: -.3px; }
.pending-strip h2 .icon { color: var(--amber); width: 18px; }
.pending-strip .panel-heading p { margin-top: 4px; }
.pending-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.pending-item { display: flex; align-items: center; gap: 12px; padding: 15px 24px; border-top: 1px solid #f1ede4; min-width: 0; }
.pending-item:hover { background: #fffcf5; }
.pending-item .avatar { width: 36px; height: 36px; font-size: 11px; }
.pending-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.pending-copy strong { font-size: 13px; font-weight: 600; }
.pending-copy small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.pending-copy s { color: #9aa8b6; }
.pending-copy b { color: var(--ink); font-weight: 600; }
.pending-meta { display: grid; justify-items: end; gap: 2px; font-size: 11px; color: var(--muted); }
.pending-meta .row-link { min-height: 0; font-size: 12px; }

/* Filtros e tabela de clientes */
.client-filters { grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)); }
.clients-table { min-width: 1240px; }
.clients-table td:nth-child(4) { max-width: 170px; }
.clients-table td:nth-child(2) { white-space: nowrap; }
.lives-pill { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; background: #edf3f9; color: #2f5a80; font-weight: 650; font-size: 12px; }
.list-footnote .footnote-action { margin-left: auto; font-size: 11px; }

/* Abas da ficha */
.module-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-top: 4px; overflow-x: auto; scrollbar-width: thin; }
.module-tabs a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 13px 0; font-size: 13px; font-weight: 550; color: var(--muted); white-space: nowrap; }
.module-tabs a:hover { color: var(--blue); }
.module-tabs a[aria-current] { color: var(--navy); font-weight: 650; }
.module-tabs a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--red); }
.tab-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--warning-bg); color: var(--amber); font-size: 11px; font-weight: 700; }
.tab-panel { margin-top: 24px; }
.tab-panel > .dossier-panel { height: auto; }
.dossier-attention { align-items: flex-start; }
.dossier-attention > div { flex: 1; }
.attention-link { align-self: center; font-size: 12px; color: #795014; }

/* Tabelas internas */
.module-table { min-width: 760px; }
.module-table td small { display: block; }
.name-with-avatar { display: flex; align-items: center; gap: 10px; }
.name-with-avatar .avatar { width: 32px; height: 32px; font-size: 11px; }
.name-with-avatar strong { font-size: 13px; font-weight: 600; }
.module-map { margin: 20px 24px 14px; }
.module-map > svg { height: 230px; }

/* Documentos */
.doc-list { padding: 6px 24px; }
.doc-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 15px 0; }
.doc-row + .doc-row { border-top: 1px solid #edf0f4; }
.doc-icon { width: 38px; height: 38px; border-radius: 9px; background: #edf3f9; color: #3f6d96; display: grid; place-items: center; }
.doc-icon .icon { width: 18px; height: 18px; }
.doc-copy { display: grid; gap: 2px; min-width: 0; }
.doc-copy strong { font-size: 13px; font-weight: 600; }
.doc-copy small { font-size: 11px; color: var(--muted); }
.doc-row .secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.doc-preview { display: grid; place-items: center; padding: 22px; border-radius: 10px; background: #eef2f6; margin-bottom: 20px; }
.doc-sheet { width: 220px; display: grid; gap: 9px; padding: 22px; background: white; border-radius: 4px; box-shadow: 0 6px 22px #102e4f1a; }
.doc-sheet strong { font-size: 12px; margin-bottom: 4px; }
.doc-sheet span:not(.wordmark):not(.wordmark *) { height: 6px; border-radius: 3px; background: #e5ebf1; }
.doc-sheet span.short { width: 60%; }
.small-wordmark { font-size: 22px; letter-spacing: -1.5px; padding-right: 8px; }
.small-wordmark i { font-size: 12px; top: -2px; }

/* Alterações cadastrais */
.changes-heading { align-items: flex-start; flex-wrap: wrap; }
.changes-heading p { margin-top: 4px; }
.changes-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.change-list { display: grid; gap: 16px; padding: 22px 24px; }
.change-card { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; background: white; }
.change-card.is-pending { border-color: #ead6ae; box-shadow: 0 0 0 3px #fff4df; }
.change-card:target { outline: 3px solid #aecbe3; outline-offset: 2px; }
.change-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.change-top .eyebrow { display: block; font-size: 10px; margin-bottom: 3px; }
.change-top h3 { font-size: 16px; }
.change-values { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; margin-top: 14px; }
.change-values > div { display: grid; gap: 4px; padding: 12px 14px; border-radius: 8px; background: #f5f8fb; min-width: 0; }
.change-values small { font-size: 11px; color: var(--muted); }
.change-values strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.change-values strong.requested { color: var(--blue); }
.change-arrow { font-size: 20px; color: #8ea2b6; }
.change-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin: 16px 0 0; }
.change-meta dt { font-size: 11px; color: var(--muted); }
.change-meta dd { margin: 2px 0 0; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.change-meta .fact-wide { grid-column: 1 / -1; }
.change-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf0f4; }
.change-actions .primary-button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; }
.change-actions .primary-button .icon { width: 15px; height: 15px; }
.change-actions .text-button { font-size: 12px; margin-left: auto; }
.danger-button { color: #b03346; }
.danger-button:hover { border-color: #e2a3ad; background: var(--danger-bg); }
.primary-button.danger-primary { background: #b03346; }
.primary-button.danger-primary:hover { background: #8f2738; }

/* Histórico */
.client-history li.attention .activity-dot { background: #d2a04a; }
.client-history li.danger .activity-dot { background: #c95b6b; }
.client-history li.done .activity-dot { background: #6fae98; }

/* Diálogos: formulários e central de alertas */
.dialog-form { display: grid; gap: 8px; }
.dialog-form label, .dialog-form legend { font-size: 12px; font-weight: 600; }
.dialog-form label small { color: var(--muted); font-weight: 500; }
.dialog-form input:not([type="radio"]), .dialog-form select, .dialog-form textarea { width: 100%; min-height: 42px; border: 1px solid #d4dee8; border-radius: 6px; padding: 9px 11px; font: inherit; font-size: 13px; color: var(--ink); background: white; margin-bottom: 8px; }
.dialog-form textarea { resize: vertical; }
.dialog-form input:focus, .dialog-form select:focus, .dialog-form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #25659b15; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dialog-actions button { min-height: 42px; }
.channel-choice { border: 0; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.channel-choice label { display: flex; align-items: center; gap: 9px; font-weight: 500; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.channel-choice label:has(input:checked) { border-color: var(--blue); background: #f5f9fd; }
.dialog-subtitle { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--muted); text-transform: uppercase; margin: 4px 0 10px; }
.alert-feed { display: grid; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.alert-feed-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; }
.alert-feed-item + .alert-feed-item { border-top: 1px solid #edf0f4; }
.alert-feed-item:hover { background: #f7f9fc; }
.alert-feed-item strong { display: block; font-size: 13px; font-weight: 600; }
.alert-feed-item small { font-size: 11px; color: var(--muted); }
.alert-feed-icon { width: 32px; height: 32px; border-radius: 8px; background: #edf3f9; color: #3f6d96; display: grid; place-items: center; }
.alert-feed-icon .icon { width: 16px; height: 16px; }
.alert-feed-channels { font-size: 11px; color: var(--muted); white-space: nowrap; }
.alert-prefs { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.alert-prefs-head, .alert-prefs-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px; gap: 10px; align-items: center; padding: 11px 14px; font-size: 13px; }
.alert-prefs-head { background: #fafbfd; font-size: 11px; font-weight: 600; color: var(--muted); }
.alert-prefs-head span:not(:first-child), .alert-prefs-row .switch { justify-self: center; }
.alert-prefs-row { border-top: 1px solid #edf0f4; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 11px; background: #d3dce5; transition: background .15s ease; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0b25403b; transition: transform .15s ease; }
.switch input:checked + span + i { background: var(--blue); }
.switch input:checked + span + i::after { transform: translateX(16px); }
.switch input:focus-visible + span + i { outline: 3px solid #367daf; outline-offset: 2px; }

@media (max-width: 1199px) {
  .module-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; }
  .module-metrics > div { padding: 16px 20px; }
  .module-metrics > div:nth-child(4) { border-left: 0; }
  .module-metrics > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .client-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .client-filters .filter-query { grid-column: span 3; }
}
@media (max-width: 1023px) {
  .change-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .commercial-heading .heading-actions { width: 100%; }
  .module-metrics { grid-template-columns: 1fr 1fr; }
  .module-metrics > div { padding: 14px 16px; }
  .module-metrics > div:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .module-metrics > div:nth-child(even) { border-left: 1px solid var(--line); }
  .module-metrics > div:nth-child(-n+2) { border-top: 0; }
  .module-metrics > div:last-child { grid-column: auto; }
  .pending-strip .panel-heading { padding: 16px; flex-direction: column; }
  .pending-list { grid-template-columns: 1fr; }
  .pending-item { padding: 14px 16px; align-items: flex-start; }
  .pending-meta { display: none; }
  .client-filters { grid-template-columns: 1fr 1fr; }
  .client-filters .filter-query { grid-column: 1 / -1; }
  .list-footnote { flex-wrap: wrap; }
  .list-footnote .footnote-action { margin-left: 25px; }
  .module-tabs { gap: 20px; margin-inline: -16px; padding-inline: 16px; }
  .module-tabs a { font-size: 12px; }
  .tab-panel { margin-top: 18px; }
  .module-map { margin: 16px 18px 12px; }
  .module-map > svg { height: 180px; }
  .doc-list { padding-inline: 18px; }
  .doc-row { grid-template-columns: 38px minmax(0, 1fr); }
  .doc-row .badge, .doc-row .secondary-button { grid-column: 2; justify-self: start; }
  .change-list { padding: 16px 14px; }
  .change-card { padding: 16px; }
  .change-values { grid-template-columns: 1fr; gap: 6px; }
  .change-arrow { transform: rotate(90deg); justify-self: center; }
  .change-meta { grid-template-columns: 1fr; }
  .change-actions .text-button { margin-left: 0; }
  .changes-heading { padding: 18px; }
  .dossier-attention { flex-wrap: wrap; }
  .attention-link { margin-left: 38px; }
  .alert-feed-item { grid-template-columns: 32px minmax(0, 1fr); }
  .alert-feed-channels { grid-column: 2; }
  .alert-prefs-head, .alert-prefs-row { grid-template-columns: minmax(0, 1fr) 54px 64px; padding-inline: 10px; font-size: 12px; }
}
