/* ERP Soalhe — estilos do app (usa tokens.css) */

a { color: var(--gold-dark); text-decoration: none; }
button { font-family: var(--font-family); cursor: pointer; }

/* ───────── Layout: sidebar + conteúdo ───────── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; background: var(--ink-mid); color: #fff;
  border-right: 3px solid var(--gold);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand img {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--gold); object-fit: cover;
}
.sidebar .brand .t1 { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.sidebar .brand .t2 { font-size: 15px; font-weight: 700; color: #fff; }

.nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: #cbd0d6; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--gold); color: var(--ink); font-weight: 600; }
.nav .ico { width: 18px; text-align: center; }

.sidebar .user {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #cbd0d6; display: flex; align-items: center; justify-content: space-between;
}
.sidebar .user button {
  background: transparent; border: 1px solid rgba(255,255,255,.2); color: #cbd0d6;
  border-radius: 6px; padding: 4px 8px; font-size: 11px;
}

.content { flex: 1; min-width: 0; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.page { padding: 24px; }

/* ───────── Componentes ───────── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header {
  background: var(--gold-xlight); border-bottom: 1px solid var(--gold-light);
  padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--gold-dark);
}
.card-body { padding: 16px; }

/* Cabeçalho de card premium — barra de acento dourada + título editorial */
.card-header { position: relative; padding-left: 18px; color: var(--ink); font-weight: 800; font-size: 13.5px; letter-spacing: .005em; }
.card-header::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; background: linear-gradient(180deg, var(--gold), var(--gold-dark)); border-radius: 0 4px 4px 0; }

/* Mapa no Dashboard: coluna com largura controlada (sem vazio) + SVG fluido */
.dash-reach { display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 20px; align-items: start; }
#dash-map svg { width: 100%; height: auto; display: block; }
#dash-map { max-width: 440px; margin: 0 auto; }
@media (max-width: 860px) { .dash-reach { grid-template-columns: 1fr; } }

.btn {
  background: var(--gold); color: var(--ink); padding: 9px 18px; border-radius: var(--radius-sm);
  border: none; font-weight: 600; font-size: 13px;
}
.btn:hover { background: var(--gold-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--gold-dark); border: 1.5px solid var(--gold); }
.btn-outline:hover { background: var(--gold-xlight); color: var(--gold-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: none; }

input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-800); background: #fff; font-family: var(--font-family);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus-ring); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-500); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border-left: 4px solid var(--gold); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--gray-500); }
.kpi .value { font-size: 30px; font-weight: 800; color: var(--gold-dark); font-variant-numeric: tabular-nums; }
.kpi.warn { border-left-color: var(--warn); } .kpi.warn .value { color: var(--warn); }
.kpi.danger { border-left-color: var(--danger); } .kpi.danger .value { color: var(--danger); }
.kpi.ok { border-left-color: var(--success); } .kpi.ok .value { color: var(--success); }

/* Tabela */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--gold-xlight); color: var(--gold-dark); font-weight: 700; text-align: left; padding: 10px 12px; white-space: nowrap; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); }
tbody tr:hover { background: #fafafa; }

/* Toolbar de filtros */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.toolbar .spacer { flex: 1; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--gray-200); color: var(--gray-700); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-md); }
.modal-header { background: var(--ink-mid); color: #fff; padding: 14px 18px; border-bottom: 3px solid var(--gold); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header button { background: transparent; border: none; color: #fff; font-size: 20px; }
.modal-body { padding: 18px; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* Toast */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-size: 13px; font-weight: 500; border: 1px solid; }
.toast.ok { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.toast.err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.muted { color: var(--gray-400); font-size: 12px; }
.empty { text-align: center; padding: 40px; color: var(--gray-400); }

/* ───────── Grid de cards de clientes (uniforme, sem cortar dados) ───────── */
.cli-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
  align-items: stretch;            /* cards da mesma linha esticam igual */
}
.cli-card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.cli-card:hover { box-shadow: var(--shadow-md); border-color: var(--gold); }
.cli-card .cc-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--ink-mid); border-bottom: 2px solid var(--gold);
}
.cli-card .cc-cod {
  background: var(--gold); color: var(--ink); font-weight: 800; font-size: 12px;
  padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cli-card .cc-name {
  flex: 1; min-width: 0; color: #fff; font-weight: 700; font-size: 13px; line-height: 1.3;
  overflow-wrap: anywhere;          /* quebra nomes longos SEM cortar/ocultar */
}
.cli-card .cc-body { padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.cli-card .cc-row { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; }
.cli-card .cc-row .k { color: var(--gray-500); font-weight: 600; min-width: 58px; flex-shrink: 0; }
.cli-card .cc-row .v { color: var(--gray-800); overflow-wrap: anywhere; }
.cli-card .cc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cli-card .cc-foot {
  margin-top: auto; padding: 9px 12px; border-top: 1px solid var(--gray-200);
  display: flex; gap: 8px; align-items: center; background: #fafafa;
}
.cli-card .cc-foot .wa { font-size: 11px; color: var(--gray-500); overflow-wrap: anywhere; flex: 1; }
.cli-card.inativo { opacity: .82; }
.cli-card.inativo .cc-top { background: #2a2a2a; border-bottom-color: var(--gray-400); }

.result-count { font-size: 13px; color: var(--gray-500); margin-bottom: 12px; font-weight: 600; }

/* Cards de presença nacional (Dashboard) */
.reach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reach-stat { background: var(--gold-xlight); border: 1px solid var(--gold-light); border-radius: 10px; padding: 12px 14px; text-align: center; transition: transform .15s, box-shadow .15s; }
.reach-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.reach-stat .rs-num { font-size: 26px; font-weight: 800; color: var(--gold-dark); line-height: 1; font-variant-numeric: tabular-nums; }
.reach-stat .rs-num span { font-size: 14px; color: var(--gray-400); font-weight: 600; }
.reach-stat .rs-lab { font-size: 11px; font-weight: 600; color: var(--gray-500); margin-top: 5px; }
#dash-map .uf-shape { cursor: pointer; }

/* ───────── Sub-abas ───────── */
.subtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; flex-wrap: wrap; }
.subtab {
  background: transparent; border: none; padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--gray-500); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer;
}
.subtab:hover { color: var(--gold-dark); }
.subtab.active { color: var(--gold-dark); border-bottom-color: var(--gold); }

/* ───────── Gráfico de barras horizontais (proporcional, premium) ───────── */
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(96px, 130px) 1fr 62px; align-items: center; gap: 12px; }
.hbar-lab { font-size: 12.5px; font-weight: 600; color: var(--gray-800); overflow-wrap: anywhere; line-height: 1.2; }
.hbar-track { height: 20px; background: #f4eece; border-radius: 7px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(139,105,20,.08); }
.hbar-bar { display: block; height: 100%; border-radius: 7px; min-width: 6px;
  background: linear-gradient(90deg, #E9C84C 0%, #C9A227 55%, #8B6914 100%);
  box-shadow: inset 0 -2px 4px rgba(139,105,20,.28);
  transition: filter .15s, transform .15s; transform-origin: left center; }
.hbar:hover .hbar-bar { filter: brightness(1.08) saturate(1.1); }
.hbar-bar.alt { background: linear-gradient(90deg, #3a3a3a 0%, #1f1f1f 100%); box-shadow: inset 0 -2px 4px rgba(0,0,0,.3); }
.hbar-num { text-align: right; font-weight: 800; color: var(--gold-dark); font-variant-numeric: tabular-nums; font-size: 14px; line-height: 1; }
.hbar-num small { display: block; font-size: 9.5px; font-weight: 600; color: var(--gray-400); margin-top: 1px; }
.hbar.alt .hbar-num, .hbar:has(.hbar-bar.alt) .hbar-num { color: var(--ink); }

/* Gráfico de colunas (séries temporais longas) */
.colchart { display: flex; align-items: flex-end; gap: 3px; height: 170px; overflow-x: auto; padding: 18px 4px 2px; }
.colchart .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 0 20px; min-width: 16px; height: 100%; cursor: default; }
.colchart .cval { font-size: 9px; font-weight: 700; color: var(--gray-500); margin-bottom: 2px; height: 11px; }
.colchart .bar { width: 64%; min-height: 0; background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%); border-radius: 3px 3px 0 0; transition: filter .12s, transform .12s; }
.colchart .col:hover .bar { filter: brightness(1.12); transform: scaleY(1.02); }
.colchart .bar.acc { background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%); }
.colchart .clab { font-size: 9px; font-weight: 700; color: var(--gray-400); margin-top: 5px; height: 12px; white-space: nowrap; }

/* Tabela comparativa premium */
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.cmp-table th { background: var(--gold-xlight); color: var(--gold-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; text-align: right; }
.cmp-table th:first-child { text-align: left; }
.cmp-table td { padding: 9px 12px; border-top: 1px solid var(--gray-200); text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table td:first-child { text-align: left; font-weight: 700; }
.cmp-table tbody tr:hover { background: #fafafa; }
.cmp-pos { color: var(--success); font-weight: 700; }
.cmp-neg { color: var(--danger); font-weight: 700; }

/* Tabelas nunca cortam — rolam na horizontal se faltar largura */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
.cmp-table, .ficha-table { min-width: 360px; }
/* Cards de tabela ocupam a linha inteira do grid (mais espaço, sem corte) */
.insights > .card.wide { grid-column: 1 / -1; }

/* Lista de insights estratégicos */
.insights-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.insights-list li { font-size: 13px; line-height: 1.5; color: var(--gray-800); padding: 10px 14px; background: var(--gold-xlight); border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; }
.insights-list li b { color: var(--gold-dark); }
.insights-list li { transition: transform .15s, box-shadow .15s; }
.insights-list li:hover { transform: translateX(3px); box-shadow: var(--shadow); }

/* ════════════════ VIDA & MICRO-INTERAÇÕES (inspirado em RM/RISO, paleta Soalhe) ════════════════ */

/* Fundo com brilho dourado sutil + scrollbar da marca */
body {
  background:
    radial-gradient(circle at 0% 0%, rgba(201,162,39,.06), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(17,17,17,.03), transparent 34%),
    var(--bg);
  background-attachment: fixed;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9cfa8; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Header com leve vidro */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* Entradas animadas (cards surgem suavemente) */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.page > * , .kpis .kpi, .insights > .card, .cli-grid > .cli-card { animation: fadeUp .42s cubic-bezier(.2,.7,.2,1) both; }
.kpis .kpi:nth-child(1){animation-delay:.02s} .kpis .kpi:nth-child(2){animation-delay:.06s}
.kpis .kpi:nth-child(3){animation-delay:.10s} .kpis .kpi:nth-child(4){animation-delay:.14s}
.kpis .kpi:nth-child(5){animation-delay:.18s} .kpis .kpi:nth-child(6){animation-delay:.22s}
.kpis .kpi:nth-child(7){animation-delay:.26s} .kpis .kpi:nth-child(8){animation-delay:.30s}
.insights > .card:nth-child(2){animation-delay:.05s} .insights > .card:nth-child(3){animation-delay:.10s}
.insights > .card:nth-child(4){animation-delay:.15s} .insights > .card:nth-child(5){animation-delay:.20s}
.insights > .card:nth-child(6){animation-delay:.25s}
.modal { animation: popIn .28s cubic-bezier(.2,1.2,.4,1) both; }

/* KPI premium: número grande, pointer, brilho dourado no hover */
.kpi { cursor: default; }
.kpi .value { transition: color .2s; }
.kpi:hover .value { color: var(--gold-dark); }
.kpi.ok:hover .value { color: var(--success); } .kpi.danger:hover .value { color: var(--danger); } .kpi.warn:hover .value { color: var(--warn); }

/* Cards de conteúdo: entrada animada + lift no hover (vale para TODOS os cards) */
.card { animation: fadeUp .42s cubic-bezier(.2,.7,.2,1) both; transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--gold-light); }
.insights > .card:hover { transform: translateY(-3px); }
/* o documento da Ficha não deve "pular" no hover */
.ficha-sheet:hover { transform: none; }

/* Cards de cliente / acesso: lift + leve realce do código */
.cli-card .cc-cod { transition: transform .15s; }
.cli-card:hover .cc-cod { transform: scale(1.06); }

/* Barras crescem da esquerda ao renderizar */
.bar-fill { transform-origin: left center; animation: growX .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-row:hover .bar-fill { filter: brightness(1.08); }
/* Colunas crescem de baixo */
.colchart .bar { transform-origin: bottom center; animation: growY .65s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Donut entra girando */
.donut { animation: donutIn .6s ease both; }
@keyframes donutIn { from { transform: rotate(-90deg) scale(.9); opacity: .2; } to { transform: none; opacity: 1; } }

/* Número "subindo" (count-up) — leve realce enquanto anima */
.value.counting { color: var(--gold); }

/* Skeleton shimmer (carregamento com vida) */
.skel { background: linear-gradient(90deg, var(--gray-200) 0%, #eee 50%, var(--gray-200) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; height: 16px; }
.skel-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.skel-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Linha-guia de seção (estilo RM h-section) */
.h-sec { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-400); margin: 4px 0 14px; }
.h-sec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-light), transparent); }

/* Respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* Donut (conic-gradient) */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ''; position: absolute; inset: 24px; background: #fff; border-radius: 50%; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.donut-legend .dl { display: flex; align-items: center; gap: 8px; }
.donut-legend .sw { width: 12px; height: 12px; border-radius: 3px; }

/* Insights grid — cards dimensionados ao conteúdo (sem esticar = sem sobras em branco) */
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.insights .card-body { padding: 14px; }
/* estado vazio compacto dentro de cards (não estoura altura) */
.card-body .empty, .doc-empty { padding: 14px; font-size: 12px; }

/* Botões de ordenação / toggle de visão */
.sort-btns { display: inline-flex; gap: 6px; }
.sort-btns button, .view-toggle button {
  background: #fff; border: 1.5px solid var(--gray-300); color: var(--gray-700);
  padding: 7px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
}
.sort-btns button.ativo, .view-toggle button.ativo { background: var(--gold); color: var(--ink); border-color: var(--gold); }

/* ───────── Mapa de atuação (modelo RISO, paleta Soalhe) ───────── */
.mapa-wrap { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(260px, 360px); gap: 20px; align-items: start; }
.mapa-svg-box { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
#svg-host { width: 100%; }
#svg-host svg { width: 100%; height: auto; display: block; }
#svg-host .uf-shape { cursor: pointer; transition: fill .12s, stroke .12s; }
#svg-host .uf-shape:hover { stroke: var(--gold-dark); stroke-width: 1.2; }
#svg-host .uf-shape.sel { stroke: var(--ink); stroke-width: 1.6; }
.uf-label { font: 700 7px var(--font-family); pointer-events: none; }
.mapa-legenda { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 11px; color: var(--gray-500); }
.mapa-legenda .escala { display: flex; }
.mapa-legenda .escala span { width: 22px; height: 12px; }
.map-tip {
  position: fixed; z-index: 200; background: var(--ink-mid); color: #fff; border: 1px solid var(--gold);
  border-radius: 8px; padding: 8px 11px; font-size: 12px; pointer-events: none; display: none;
  box-shadow: var(--shadow-md); min-width: 150px;
}
.map-tip b { display: block; color: var(--gold); margin-bottom: 3px; }
.map-tip span { display: block; }
.breadcrumb { font-size: 13px; margin-bottom: 12px; color: var(--gray-500); }
.breadcrumb a { color: var(--gold-dark); cursor: pointer; font-weight: 600; }
.breadcrumb .sep { margin: 0 6px; color: var(--gray-400); }
.geo-painel { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; max-height: 460px; overflow: auto; }
.geo-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.geo-row:hover { background: var(--gold-xlight); }
.geo-row .rank { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; color: #fff; flex-shrink: 0; }
.geo-row .gnome { flex: 1; font-size: 13px; color: var(--gray-800); font-weight: 600; overflow-wrap: anywhere; }
.geo-row .gcount { font-weight: 800; color: var(--gold-dark); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .mapa-wrap { grid-template-columns: 1fr; } }

/* ───────── Cadastro Geral ───────── */
.cad-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--gold-xlight); border: 1px solid var(--gold-light); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 14px;
}
.subtabs-2 { border-bottom-width: 1px; }
.subtabs-2 .subtab { font-size: 12px; padding: 8px 13px; }

.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.ficha-grid .fd { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ficha-grid .fk { font-size: 11px; font-weight: 600; color: var(--gray-500); }
.ficha-grid .fv { font-size: 13px; color: var(--gray-800); overflow-wrap: anywhere; }
@media (max-width: 480px) { .ficha-grid { grid-template-columns: 1fr; } }

/* botão-link discreto (copiar / revelar) */
.lnk { background: none; border: none; color: var(--gold-dark); font-size: 11px; font-weight: 600; cursor: pointer; padding: 0 2px; }
.lnk:hover { text-decoration: underline; }
.senha { font-family: ui-monospace, monospace; letter-spacing: 1px; }

/* listas de documentos (Documentação) */
.doc-list { border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--gray-200); }
.doc-row:last-child { border-bottom: none; }
.doc-row .v { overflow-wrap: anywhere; min-width: 0; }
input[type=file] { padding: 7px 9px; font-size: 12px; background: #fff; }
input[type=file]::file-selector-button { font-family: var(--font-family); font-weight: 600; font-size: 12px; border: 1px solid var(--gray-300); background: var(--gold-xlight); color: var(--gold-dark); border-radius: 6px; padding: 4px 10px; margin-right: 10px; cursor: pointer; transition: background .15s, color .15s; }
input[type=file]::file-selector-button:hover { background: var(--gold); color: var(--ink); }

/* ════════════════ CAMADA PREMIUM (todas as abas) ════════════════ */
:root { --shadow: 0 1px 3px rgba(17,17,17,.06), 0 1px 2px rgba(17,17,17,.04); --shadow-md: 0 8px 24px rgba(17,17,17,.10); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Cards: borda sutil + transição + hover elegante (sem pular o layout) */
.card { border: 1px solid var(--gray-200); transition: box-shadow .2s ease, border-color .2s ease; }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--gold-light); }
.card-header { background: linear-gradient(180deg, var(--gold-xlight) 0%, #fffdf6 100%); letter-spacing: .01em; }

/* KPIs premium: leve elevação + linha-guia dourada que cresce no hover */
.kpi { position: relative; transition: box-shadow .2s ease, transform .2s ease; }
.kpi::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); border-radius: var(--radius) 0 0 var(--radius); opacity: .0; transition: opacity .2s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi:hover::after { opacity: 1; }
.kpi .value { letter-spacing: -.02em; }

/* Cards de cliente / acesso: elevação no hover */
.cli-card { transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease; }
.cli-card:hover { transform: translateY(-3px); }

/* Botões premium: micro-interação ao clicar + brilho no CTA */
.btn, .btn-outline, .btn-danger { transition: background .15s, color .15s, box-shadow .15s, transform .06s; }
.btn:hover { box-shadow: 0 4px 12px rgba(201,162,39,.32); }
.btn:active, .btn-outline:active, .btn-danger:active { transform: translateY(1px); }

/* Sub-abas premium */
.subtab { border-radius: 8px 8px 0 0; transition: color .15s, border-color .15s, background .15s; }
.subtab:hover { background: var(--gold-xlight); }

/* Tabelas premium: cabeçalho com leve gradiente, linha selecionável */
thead th { position: sticky; top: 0; background: linear-gradient(180deg, var(--gold-xlight), #fdf8ea); z-index: 1; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--gold-xlight); }

/* Linhas geo / acessos com realce */
.geo-row { transition: background .14s, transform .14s; }
.geo-row:hover { transform: translateX(2px); }

/* ════════════════ FICHA CADASTRAL — modelo "ficha compartilhável" ════════════════ */
.ficha-sheet {
  background: #fff; border: 1px solid var(--gray-200); border-radius: 14px;
  box-shadow: var(--shadow-md); overflow: hidden; max-width: 980px; margin: 0 auto;
}
.ficha-head {
  display: flex; align-items: center; gap: 18px; padding: 22px 26px;
  background: linear-gradient(120deg, var(--ink-mid) 0%, #2a2a2a 100%);
  border-bottom: 4px solid var(--gold); color: #fff;
}
.ficha-logo { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0; background:#fff; }
.ficha-head-main { flex: 1; min-width: 0; }
.ficha-head-main .fh-cod { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--gold); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.ficha-head-main .fh-razao { font-size: 22px; font-weight: 800; color: #fff; line-height: 1.15; margin: 4px 0 2px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ficha-head-main .fh-sub { font-size: 13px; color: #d9c98f; overflow-wrap: anywhere; }
.ficha-head-meta { text-align: right; display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.ficha-head-meta .chip { background: rgba(201,162,39,.18); border: 1px solid var(--gold); color: var(--gold); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }

.ficha-actions { display: flex; gap: 10px; padding: 16px 26px; border-bottom: 1px solid var(--gray-200); flex-wrap: wrap; background: #fafafa; }
.ficha-body { padding: 8px 26px 22px; }
.ficha-section { padding: 18px 0; border-bottom: 1px dashed var(--gray-200); }
.ficha-section:last-child { border-bottom: none; }
.ficha-section-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.ficha-section-title::before { content: ''; width: 14px; height: 2px; background: var(--gold); }

.ficha-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 22px; }
.ficha-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ficha-field .ff-k { font-size: 10.5px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }
.ficha-field .ff-v { font-size: 14px; color: var(--gray-800); font-weight: 500; overflow-wrap: anywhere; }
.ficha-field.wide { grid-column: 1 / -1; }
.ficha-field .ff-v.big { font-size: 16px; font-weight: 700; color: var(--gold-dark); }

.ficha-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden; }
.ficha-table th { background: var(--gold-xlight); color: var(--gold-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; text-align: left; }
.ficha-table td { padding: 9px 12px; border-top: 1px solid var(--gray-200); font-size: 13px; }
.ficha-table tbody tr:hover { background: #fafafa; }

.ficha-cnae { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.ficha-cnae:last-child { border-bottom: none; }
.ficha-cnae .cod { font-family: ui-monospace, monospace; font-weight: 700; color: var(--gold-dark); font-size: 12px; white-space: nowrap; }
.ficha-foot { padding: 14px 26px; background: #fafafa; border-top: 1px solid var(--gray-200); font-size: 11px; color: var(--gray-400); display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 620px) {
  .ficha-head { flex-direction: column; text-align: center; }
  .ficha-head-meta { text-align: center; flex-direction: row; }
}

/* ════════════════ IMPRESSÃO da ficha ════════════════ */
@media print {
  body * { visibility: hidden !important; }
  #ficha-print, #ficha-print * { visibility: visible !important; }
  #ficha-print { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; }
  .no-print { display: none !important; }
  .ficha-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Botão "buscar" colado a um input (CNPJ/CEP) */
.input-action { display: flex; gap: 6px; }
.input-action input { flex: 1; min-width: 0; }
.input-action .btn, .input-action .btn-outline { white-space: nowrap; flex-shrink: 0; }

/* Linha de upload (arquivo + botão) — não estoura, quebra com elegância */
.upload-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.upload-box input[type=file] { flex: 1 1 150px; min-width: 0; }
.upload-box .btn { flex-shrink: 0; white-space: nowrap; }

/* Seções do formulário */
.form-sec { border-top: 1px solid var(--gray-200); margin-top: 6px; padding-top: 12px; }
.form-sec-title { font-size: 12px; font-weight: 700; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } }

/* ───────── Login ───────── */
#login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink-mid);
}
.login-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; max-width: 380px; overflow: hidden; border-top: 4px solid var(--gold); }
.login-head { text-align: center; padding: 28px 24px 12px; }
.login-head img { width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--gold); }
.login-head .t1 { font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--gold-dark); text-transform: uppercase; margin-top: 12px; }
.login-head .t2 { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.login-body { padding: 12px 24px 28px; }

@media (max-width: 720px) {
  .sidebar { position: fixed; left: -240px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .grid2 { grid-template-columns: 1fr; }
}
