/* =============================================================
   styles.css — Design system Sofis
   ============================================================= */

:root {
  --sofis-dark:     #2C3E50;
  --sofis-teal:     #507C8C;
  --sofis-darkteal: #3A5C69;
  --sofis-lightbg:  #F4F7F8;
  --sofis-border:   #E2E8F0;
  --sofis-gold:     #F4B01B;

  --text-main:  #2C3E50;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --bg-main:    #F4F7F8;
  --bg-white:   #ffffff;
  --topbar-h:   56px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(44,62,80,0.08);
  --shadow-md: 0 4px 12px rgba(44,62,80,0.10);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sofis-border); border-radius: 10px; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--sofis-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.topbar-brand img {
  height: 32px;
  width: auto;
}

.topbar-brand-divider {
  width: 1px;
  height: 28px;
  background: var(--sofis-border);
}

.topbar-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sofis-lightbg);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 6px 12px;
  font-size: 0.78rem;
}

.user-card-name {
  font-weight: 600;
  color: var(--sofis-dark);
}

.user-card-role {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.build-info {
  font-size: 0.60rem;
  color: var(--text-muted);
  opacity: 0.65;
  letter-spacing: 0.01em;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sofis-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Language toggle button ──────────────────────────────── */
.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--sofis-border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  flex-shrink: 0;
}
.lang-btn:hover {
  background: var(--sofis-teal);
  border-color: var(--sofis-teal);
  color: #fff;
}

/* ── Settings dropdown ────────────────────────────────────── */
.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--sofis-border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.settings-btn:hover,
.settings-btn.active {
  background: var(--sofis-dark);
  border-color: var(--sofis-dark);
  color: #fff;
}

.settings-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(44,62,80,0.14);
  min-width: 190px;
  z-index: 150;
  overflow: hidden;
}
.settings-panel.open { display: block; }

.settings-panel-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  padding: 10px 14px 6px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.settings-item:hover {
  background: var(--sofis-lightbg);
  color: var(--sofis-teal);
}
.settings-item svg { flex-shrink: 0; color: var(--text-muted); }
.settings-item:hover svg { color: var(--sofis-teal); }

.settings-divider {
  height: 1px;
  background: var(--sofis-border);
  margin: 4px 0;
}

.settings-item-danger { color: #dc2626; }
.settings-item-danger svg { color: #dc2626; }
.settings-item-danger:hover { background: #fee2e2; color: #dc2626; }
.settings-item-danger:hover svg { color: #dc2626; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-trocar-senha {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-trocar-senha:hover {
  background: #f0f8fa;
  border-color: var(--sofis-teal);
  color: var(--sofis-teal);
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  padding: 32px 24px;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sofis-dark);
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--sofis-teal);
  color: #fff;
}

.btn-primary:hover {
  background: var(--sofis-darkteal);
}

.btn-outline {
  background: var(--bg-white);
  border-color: var(--sofis-border);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--sofis-teal);
  color: var(--sofis-teal);
}

.btn-ghost {
  background: transparent;
  border-color: var(--sofis-border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--sofis-lightbg);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ── KPI Grid ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-card.kpi-loading {
  color: var(--text-faint);
  font-size: 0.8rem;
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sofis-dark);
  line-height: 1;
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 4px;
}

.kpi-card.kpi-alerta .kpi-value { color: #d97706; }
.kpi-card.kpi-danger  .kpi-value { color: #dc2626; }
.kpi-card.kpi-green   .kpi-value { color: #16a34a; }

.kpi-card-clicavel {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.kpi-card-clicavel:hover {
  border-color: var(--sofis-teal);
  box-shadow: var(--shadow-md);
}
.kpi-card-selecionado {
  border: 2px solid var(--sofis-teal) !important;
  box-shadow: 0 0 0 4px rgba(80, 124, 140, 0.12), var(--shadow-md) !important;
  background: #f0f8fa !important;
}
.kpi-card-selecionado .kpi-label::after {
  content: ' ●';
  color: var(--sofis-teal);
  font-size: 0.55rem;
  vertical-align: middle;
}

/* ── Filters bar ──────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.filter-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.filter-search input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  color: var(--text-main);
  background: var(--sofis-lightbg);
  outline: none;
  transition: border-color 0.15s;
}

.filter-search input:focus { border-color: var(--sofis-teal); }

.filters-bar select {
  padding: 7px 10px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  color: var(--text-main);
  background: var(--sofis-lightbg);
  outline: none;
  cursor: pointer;
}

.filters-bar select:focus { border-color: var(--sofis-teal); }

.btn-limpar {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-limpar:hover {
  background: var(--sofis-lightbg);
  color: var(--text-main);
}

/* ── Multi-select dropdown (filtro produto) ──────────────── */
.filter-multiselect { position: relative; }

.filter-multiselect-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  color: var(--text-main);
  background: var(--sofis-lightbg);
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: border-color 0.15s;
}
.filter-multiselect-btn:hover,
.filter-multiselect-btn.ms-open { border-color: var(--sofis-teal); color: var(--sofis-teal); }

.filter-multiselect-btn .ms-count {
  background: var(--sofis-teal);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
}

.filter-multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 300;
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 230px;
  max-height: 300px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.filter-multiselect-panel.ms-open { display: flex; }

.ms-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--sofis-border);
}
.ms-search-wrap input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  outline: none;
  box-sizing: border-box;
}
.ms-search-wrap input:focus { border-color: var(--sofis-teal); }

.ms-options { overflow-y: auto; flex: 1; }

.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-main);
  transition: background 0.1s;
}
.ms-item:hover { background: var(--sofis-lightbg); }
.ms-item input[type="checkbox"] { accent-color: var(--sofis-teal); cursor: pointer; flex-shrink: 0; }
.ms-item.ms-todos { border-bottom: 1px solid var(--sofis-border); font-weight: 600; color: var(--text-muted); }

.ms-actions {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--sofis-border);
}
.ms-actions button {
  flex: 1;
  padding: 5px 0;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid var(--sofis-border);
  background: var(--sofis-lightbg);
  color: var(--text-muted);
  transition: all 0.15s;
}
.ms-actions button:hover { background: var(--sofis-teal); color: #fff; border-color: var(--sofis-teal); }

/* ── Table info ───────────────────────────────────────────── */
.table-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 2px;
}

/* ── Contracts table ──────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  overflow-x: auto;
}

.contratos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 900px;
}

.contratos-table thead th {
  background: var(--sofis-lightbg);
  padding: 11px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--sofis-border);
  white-space: nowrap;
}

.contratos-table thead th[data-col] {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.contratos-table thead th[data-col]:hover {
  background: #e8eff3;
  color: var(--sofis-teal);
}
.contratos-table thead th[data-col]::after {
  content: ' ⇅';
  opacity: 0.3;
  font-size: 0.65rem;
}
.contratos-table thead th.th-sort-asc {
  color: var(--sofis-teal);
  background: #dff0f4;
}
.contratos-table thead th.th-sort-asc::after {
  content: ' ▲';
  opacity: 1;
  color: var(--sofis-teal);
}
.contratos-table thead th.th-sort-desc {
  color: var(--sofis-teal);
  background: #dff0f4;
}
.contratos-table thead th.th-sort-desc::after {
  content: ' ▼';
  opacity: 1;
  color: var(--sofis-teal);
}

.contratos-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text-main);
}

.contratos-table tbody tr:last-child td { border-bottom: none; }

.contratos-table tbody tr:hover td { background: #f8fafc; }

.col-acoes { width: 90px; text-align: center; }

.tabela-vazia {
  text-align: center;
  padding: 48px !important;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* celulas especiais */
.cell-razao {
  font-weight: 600;
  max-width: 200px;
}

/* Desktop: empilha razão + nome fantasia na mesma célula */
.td-razao-principal { display: block; font-weight: 600; }
.td-nome-fantasia { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.7rem; margin-top: 1px; }

.cell-razao small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.cell-num { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.75rem; }

/* ── Badges de status/alerta ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.alerta-vigente     { background: #dcfce7; color: #15803d; }
.alerta-renovacao   { background: #fef3c7; color: #92400e; }
.alerta-comercial   { background: #fee2e2; color: #991b1b; }
.alerta-inativo     { background: #f1f5f9; color: #64748b; }
.alerta-suspenso    { background: #fef9c3; color: #713f12; }
.alerta-aguardando  { background: #ede9fe; color: #5b21b6; }

/* ── Action buttons in table ──────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--sofis-border);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.btn-icon:hover { background: var(--sofis-lightbg); color: var(--sofis-teal); }
.btn-icon.btn-icon-danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,62,80,0.45);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-white);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.20);
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--sofis-border);
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sofis-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover { color: var(--sofis-dark); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

.modal-footer,
.modal-footer-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--sofis-border);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Form sections ────────────────────────────────────────── */
.form-section {
  margin-bottom: 24px;
}

.form-section:last-child { margin-bottom: 0; }

.form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sofis-teal);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--sofis-border);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-span-2 { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
}

.req { color: #dc2626; }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 11px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  color: var(--text-main);
  background: var(--bg-white);
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--font);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--sofis-teal);
  box-shadow: 0 0 0 3px rgba(80,124,140,0.12);
}

.form-group textarea { resize: vertical; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sofis-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s;
  max-width: 360px;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success { background: #16a34a; }
.toast.toast-error   { background: #dc2626; }
.toast.toast-warn    { background: #d97706; }

/* ── Nav tabs ─────────────────────────────────────────────── */
.nav-tabs {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  height: 40px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--sofis-border);
  display: flex;
  align-items: flex-end;
  padding: 0 24px;
  gap: 4px;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(44,62,80,0.05);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.nav-tab:hover  { color: var(--sofis-teal); }
.nav-tab.active { color: var(--sofis-teal); border-bottom-color: var(--sofis-teal); }

/* Empurra o main para baixo da topbar (nav-tabs removidas) */
.main-content {
  margin-top: var(--topbar-h) !important;
  padding: 28px 24px;
}

/* ── Aba sections ─────────────────────────────────────────── */
.aba-section { animation: fadeIn 0.18s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Charts ───────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-card.chart-wide { grid-column: span 1; }

.chart-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
}

.chart-canvas-sm {
  height: 200px;
}

/* Responsividade básica dos gráficos */
@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
}

/* ── Import Cards ─────────────────────────────────────────── */
.import-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 64px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.import-card {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.import-card:hover { box-shadow: var(--shadow-md); }

.import-card-revertido {
  opacity: 0.65;
  border-style: dashed;
}

.import-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.import-card-periodo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-badge-mes {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sofis-dark);
}

.import-card-file {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--sofis-lightbg);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-card-meta {
  font-size: 0.73rem;
  color: var(--text-faint);
  margin-left: auto;
}

.import-card-stats {
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  background: var(--sofis-lightbg);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}

.import-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.import-stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sofis-dark);
  line-height: 1;
}

.import-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.import-stat-criado    .import-stat-num { color: #16a34a; }
.import-stat-atualizado .import-stat-num { color: #d97706; }
.import-stat-ausente   .import-stat-num { color: #64748b; }

.import-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-rollback { color: #dc2626; border-color: #fca5a5; }
.btn-rollback:hover { background: #fee2e2; border-color: #dc2626; }

.import-revertido-info {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-style: italic;
}

/* ── Diff Modal ───────────────────────────────────────────── */
.diff-section { margin-bottom: 24px; }
.diff-section:last-child { margin-bottom: 0; }

.diff-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 10px;
}

.diff-criado     { background: #dcfce7; color: #15803d; }
.diff-atualizado { background: #fef3c7; color: #92400e; }
.diff-ausente    { background: #f1f5f9; color: #475569; }

.diff-aviso {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

.diff-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border-left: 3px solid transparent;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.diff-row-criado     { background: #f0fdf4; border-left-color: #22c55e; }
.diff-row-atualizado { background: #fffbeb; border-left-color: #f59e0b; flex-direction: column; }
.diff-row-ausente    { background: #f8fafc; border-left-color: #94a3b8; }

.diff-empresa { font-weight: 600; color: var(--sofis-dark); }
.diff-detalhe { font-size: 0.73rem; color: var(--text-muted); }

.diff-campos { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }

.diff-campo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.diff-campo-label  { font-weight: 600; color: var(--text-muted); min-width: 100px; }
.diff-valor-antes  { background: #fee2e2; color: #991b1b; padding: 1px 6px; border-radius: 4px; text-decoration: line-through; }
.diff-valor-depois { background: #dcfce7; color: #15803d; padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* ── KPI card clicável (mapa) ─────────────────────────────── */
.kpi-card-mapa {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.kpi-card-mapa:hover {
  border-color: var(--sofis-teal);
  background: #f0f8fa;
  box-shadow: var(--shadow-md);
}

/* ── Modal do Mapa ────────────────────────────────────────── */
.mapa-box {
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mapa-body {
  padding: 16px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.mapa-legenda {
  display: flex;
  gap: 16px;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.mapa-leg-item { display: flex; align-items: center; gap: 5px; }
.mapa-leg-cor  { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.mapa-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.mapa-svg-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 8px;
  min-width: 0;
}

.mapa-svg {
  width: 100%;
  height: auto;
  max-height: 65vh;
}

.mapa-detalhes {
  width: 240px;
  flex-shrink: 0;
}

.terr-panel {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 14px;
  min-height: 180px;
  height: 100%;
  overflow-y: auto;
}

.terr-state-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sofis-dark);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.terr-uf {
  font-size: 0.7rem;
  background: var(--sofis-teal);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
}

.terr-count {
  margin-left: auto;
  background: var(--sofis-teal);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 20px;
}

.terr-empty {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.terr-list { list-style: none; }

.terr-item {
  padding: 7px 0;
  border-bottom: 1px solid var(--sofis-border);
}
.terr-item:last-child { border-bottom: none; }

.terr-item-nome { font-size: 0.78rem; font-weight: 600; color: var(--sofis-dark); }
.terr-item-sub  { font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   ANÁLISE DE PRODUTOS — Matriz de Penetração
═══════════════════════════════════════════════════════════════ */

/* ── KPIs produtos ───────────────────────────────────────────── */
.prod-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .prod-kpi-grid { grid-template-columns: repeat(2,1fr); } }

.prod-kpi {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.prod-kpi-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.prod-kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--sofis-dark); line-height: 1.1; }
.prod-kpi-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.prod-kpi.accent .prod-kpi-value { color: var(--sofis-teal); }
.prod-kpi.alerta .prod-kpi-value { color: #f97316; }

/* ── Seção de gráfico ────────────────────────────────────────── */
.prod-chart-wrap {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.prod-section-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--sofis-border);
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Matriz ──────────────────────────────────────────────────── */
.matriz-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.matriz-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-white); border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm); padding: 6px 10px;
  font-size: 0.8rem; color: var(--text-muted);
}
.matriz-search input {
  border: none; outline: none; background: transparent;
  font-size: 0.8rem; color: var(--text-main); width: 200px;
}
.matriz-info { font-size: 0.75rem; color: var(--text-muted); }

.matriz-container {
  overflow: auto;
  max-height: 72vh;
  border-radius: var(--r-lg);
  border: 1px solid var(--sofis-border);
  box-shadow: var(--shadow-md);
}

.matriz-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
}

/* Cabeçalho sticky */
.matriz-table thead tr th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #2C3E50;
  color: rgba(255,255,255,0.85);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 2px solid var(--sofis-teal);
  border-right: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.matriz-table thead tr th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 4;
  background: #2C3E50;
  border-right: 2px solid var(--sofis-teal);
  min-width: 220px;
}

/* Subtítulo de produto no header (MRR total) */
.th-prod-mrr {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}

/* Coluna cliente sticky */
.matriz-table tbody tr td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-white);
  border-right: 2px solid var(--sofis-border);
  padding: 8px 14px;
  min-width: 220px;
}
.matriz-table tbody tr:hover td { background: #f1f8fa; }
.matriz-table tbody tr:hover td:first-child { background: #e8f4f7; }

.m-cliente-nome {
  font-weight: 600;
  color: var(--sofis-dark);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.m-cliente-sub {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Células de produto */
.matriz-table tbody tr td.m-cell {
  text-align: center;
  padding: 6px 8px;
  border-right: 1px solid var(--sofis-border);
  border-bottom: 1px solid var(--sofis-border);
  vertical-align: middle;
}

.m-filled {
  background: linear-gradient(135deg, #507C8C 0%, #3d6070 100%);
  border-radius: 6px;
  padding: 5px 8px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
  min-width: 72px;
  box-shadow: 0 1px 4px rgba(80,124,140,0.30);
}

.m-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff5ec;
  color: #f97316;
  font-size: 1rem;
  font-weight: 300;
  border: 1px dashed #fdba74;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s;
}
.matriz-table tbody tr:hover .m-empty { opacity: 1; transform: scale(1.15); }

/* Linha de total (rodapé) */
.matriz-table tfoot tr td {
  background: #f8fafc;
  border-top: 2px solid var(--sofis-teal);
  padding: 9px 14px;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--sofis-dark);
  text-align: center;
  position: sticky;
  bottom: 0;
  z-index: 1;
}
.matriz-table tfoot tr td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  background: #f8fafc;
  border-right: 2px solid var(--sofis-border);
}
.m-total-val { color: var(--sofis-teal); font-size: 0.78rem; }

/* ── Visão do Cliente ─────────────────────────────────────── */
.cv-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,62,80,0.50);
  z-index: 300;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 40px;
  overflow-y: auto;
}
.cv-overlay.open { display: flex; }

.cv-box {
  background: var(--bg-white);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 72px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 960px;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--sofis-border);
  background: var(--bg-white);
}
.cv-topbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.cv-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cv-close:hover { background: var(--sofis-lightbg); color: var(--sofis-dark); }

.cv-loading {
  padding: 64px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Header do cliente */
.cv-header {
  background: linear-gradient(135deg, var(--sofis-dark) 0%, var(--sofis-darkteal) 100%);
  padding: 28px 28px 24px;
  color: #fff;
}
.cv-nome-fantasia {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}
.cv-razao-social {
  font-size: 0.82rem;
  opacity: 0.72;
  margin-bottom: 12px;
}
.cv-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  opacity: 0.88;
}
.cv-meta-sep { opacity: 0.5; }
.cv-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.cv-badge-pub  { background: rgba(80,124,140,0.35); color: #a7d3e0; border: 1px solid rgba(167,211,224,0.3); }
.cv-badge-priv { background: rgba(244,176,27,0.25); color: #fcd984; border: 1px solid rgba(252,217,132,0.3); }

/* KPI Grid */
.cv-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--sofis-border);
}
@media (max-width: 700px) { .cv-kpi-grid { grid-template-columns: repeat(2,1fr); } }

.cv-kpi {
  padding: 20px 22px;
  border-right: 1px solid var(--sofis-border);
}
.cv-kpi:last-child { border-right: none; }
.cv-kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cv-kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--sofis-dark);
  line-height: 1.1;
}
.cv-kpi-sub {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 4px;
}
.cv-kpi-accent .cv-kpi-value { color: var(--sofis-teal); }

/* Seções */
.cv-section {
  padding: 22px 28px;
  border-bottom: 1px solid var(--sofis-border);
}
.cv-section:last-child { border-bottom: none; }

.cv-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.cv-count {
  margin-left: 2px;
  background: var(--sofis-lightbg);
  color: var(--sofis-teal);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Produto pills */
.cv-prod-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cv-prod-pill {
  background: #eef6f8;
  color: var(--sofis-teal);
  border: 1px solid #c8dfe5;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Tabela de contratos */
.cv-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--sofis-border);
}
.cv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.cv-table thead th {
  background: var(--sofis-dark);
  color: rgba(255,255,255,0.85);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.cv-table tbody tr {
  border-bottom: 1px solid var(--sofis-border);
  transition: background 0.12s;
}
.cv-table tbody tr:last-child { border-bottom: none; }
.cv-table tbody tr:hover { background: var(--sofis-lightbg); }
.cv-table tbody td {
  padding: 10px 12px;
  color: var(--text-main);
  vertical-align: middle;
}
.cv-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Botão "Visão" na tabela de contratos */
.btn-icon-view:hover { background: #eef6f8; color: var(--sofis-teal); border-color: #c8dfe5; }

/* Nome clicável na matriz */
.m-cliente-link {
  cursor: pointer;
  transition: color 0.15s;
}
.m-cliente-link:hover .m-cliente-nome { color: var(--sofis-teal); text-decoration: underline; text-underline-offset: 3px; }

/* ═══════════════════════════════════════════════════════════════
   Evolução Financeira (MoM)
   ═══════════════════════════════════════════════════════════════ */

/* Cabeçalho da aba */
.evol-competencia-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}
.evol-comp-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.evol-comp-select {
  height: 38px;
  border: 1.5px solid var(--sofis-border);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
  min-width: 160px;
}
.evol-comp-select:focus {
  outline: none;
  border-color: var(--sofis-teal);
}

/* Estados de conteúdo */
.evol-loading, .evol-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Período do comparativo */
.evol-periodo {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.evol-periodo strong {
  color: var(--text-main);
}

/* KPI cards */
.evol-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .evol-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.evol-kpi-card {
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.evol-kpi-titulo {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.evol-kpi-valor {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.evol-kpi-delta {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 6px;
}
.evol-kpi-prev {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Variação colorida */
.delta-pos { color: #28a745; }
.delta-neg { color: #dc3545; }

/* Seções internas */
.evol-section {
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.evol-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}
.evol-title-pos { color: #28a745; }
.evol-title-neg { color: #dc3545; }

/* Waterfall: tabela + gráfico lado a lado */
.evol-waterfall-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 768px) {
  .evol-waterfall-wrap { grid-template-columns: 1fr; }
}
.evol-table-wrap { overflow-x: auto; }
.evol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.evol-table thead th {
  background: var(--sofis-dark);
  color: rgba(255,255,255,0.8);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  text-align: left;
}
.evol-table tbody tr { border-bottom: 1px solid var(--sofis-border); }
.evol-table tbody td { padding: 8px 12px; }
.evol-table tbody td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.wf-base td { background: #f8f9fa; }
.wf-pos td  { color: #28a745; }
.wf-neg td  { color: #dc3545; }
.wf-net td  { background: #f0f9f4; font-weight: 600; }
.wf-atual td { background: var(--sofis-lightbg); font-weight: 700; }

.evol-chart-wrap { height: 260px; position: relative; }

/* Movers grid */
.evol-movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .evol-movers-grid { grid-template-columns: 1fr; }
}
.evol-mover-card {
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.evol-mover-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.evol-mover-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--sofis-border);
  gap: 12px;
}
.evol-mover-list li:last-child { border-bottom: none; }
.evol-mover-nome {
  font-size: 0.82rem;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evol-mover-mrr {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.evol-mover-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 8px 0 0;
}

/* Card de Insights IA */
.evol-insights-card {}
.evol-insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.evol-insights-header .evol-section-title { margin-bottom: 0; }
.btn-insights {
  background: var(--sofis-teal);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-insights:hover:not(:disabled) { background: #0a7a7a; }
.btn-insights:disabled { background: #9bcece; cursor: not-allowed; }

.evol-insights-body { min-height: 60px; }
.evol-insights-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}
.evol-insights-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.evol-insights-texto {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.65;
}
.evol-insights-texto p {
  margin: 0 0 12px 0;
}
.evol-insights-texto p:last-child { margin-bottom: 0; }

/* Totalizador dos blocos mover */
.evol-mover-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--sofis-lightbg);
  border-radius: var(--r-sm);
  border-top: 2px solid var(--sofis-border);
  font-size: 0.8rem;
  font-weight: 700;
}
.evol-mover-total span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Seletores duplos de competência */
.evol-comp-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.evol-comp-sep {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 10px;
  letter-spacing: 0.05em;
}

/* Botão de reconstrução de snapshots */
.evol-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.btn-rebuild {
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid var(--sofis-border);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.btn-rebuild:hover:not(:disabled) {
  border-color: var(--sofis-teal);
  color: var(--sofis-teal);
}
.btn-rebuild:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Botão PDF ──────────────────────────────────────────────── */
.btn-icon-pdf:hover { background: #fff1f1; color: #dc2626; border-color: #fca5a5; }

/* ── Cards de contratos na visão do cliente ─────────────────── */
.cv-contratos-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cv-contrato-card {
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  background: var(--sofis-lightbg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cv-contrato-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cv-contrato-card-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cv-contrato-produto {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--sofis-dark);
  word-break: break-word;
}

.cv-contrato-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.cv-contrato-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px 16px;
}

.cv-contrato-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cv-contrato-field-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.cv-contrato-field-val {
  font-size: 0.85rem;
  color: var(--sofis-dark);
}

.cv-contrato-valor {
  font-weight: 700;
  color: var(--sofis-teal);
}

@media (max-width: 480px) {
  .cv-contrato-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cv-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Modal PDF ──────────────────────────────────────────────── */
.modal-pdf-overlay { align-items: center; justify-content: center; z-index: 500; }

.modal-pdf-box {
  width: 90vw;
  max-width: 960px;
  height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: var(--r-md);
  overflow: hidden;
}

.modal-pdf-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #525659;
}

.modal-pdf-body iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #525659;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE — Adaptação completa para smartphone
   Breakpoints: ≤768px (tablet), ≤600px (phone), ≤480px (small phone), ≤400px (tiny)
   ═══════════════════════════════════════════════════════════════ */

/* ── Global: touch targets e espaçamentos ────────────────────── */
@media (max-width: 600px) {
  .main-content { padding: 18px 14px 28px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }

  .filters-bar select,
  .filter-search input,
  .form-input,
  .evol-comp-select { min-height: 44px; font-size: 0.95rem; }

  .btn-icon { width: 38px; height: 38px; }
}

/* ── Topbar ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
}
@media (max-width: 480px) {
  .topbar-title { display: none; }
  .topbar-brand-divider { display: none; }
  .user-card-role { display: none; }
}

/* ── Nav-tabs: scroll horizontal ─────────────────────────────── */
@media (max-width: 768px) {
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 10px;
    gap: 2px;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }

  .nav-tab {
    padding: 8px 12px;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.78rem;
  }
}
@media (max-width: 400px) {
  .nav-tab { padding: 8px 10px; font-size: 0.73rem; }
  .nav-tab svg { flex-shrink: 0; }
}

/* ── Filtros: stack vertical ─────────────────────────────────── */
@media (max-width: 600px) {
  .filters-bar { flex-direction: column; gap: 8px; }

  .filters-bar select,
  .filter-multiselect,
  .filter-multiselect-btn { width: 100%; box-sizing: border-box; }

  .filter-search { width: 100%; min-width: 0; }
  .filter-search input { width: 100%; box-sizing: border-box; }

  .filters-bar .btn-outline { width: 100%; justify-content: center; }
}

/* ── Tabela de contratos: card view ─────────────────────────── */
@media (max-width: 768px) {
  /* display:block no table e tbody para ativar card layout */
  .contratos-table { display: block; min-width: 0; }
  .contratos-table tbody { display: block; }

  .contratos-table thead { display: none; }

  .contratos-table tbody tr {
    display: block;
    border: 1px solid var(--sofis-border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    background: var(--sofis-card, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
  }

  .contratos-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border: none;
    font-size: 0.85rem;
    min-height: 0;
    gap: 8px;
  }

  .contratos-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 80px;
  }

  /* Nome do cliente: empilha razão + nome fantasia */
  .contratos-table td.cell-razao {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sofis-border);
    margin-bottom: 4px;
    gap: 2px;
  }
  .contratos-table td.cell-razao::before { display: none; }
  .td-razao-principal { font-weight: 700; font-size: 0.9rem; color: var(--sofis-dark); }
  .td-nome-fantasia { font-size: 0.78rem; color: var(--text-muted); }

  /* Linha de ações: ocupa largura total, botões à esquerda */
  .contratos-table td.col-acoes {
    display: flex !important;
    justify-content: flex-start;
    border-top: 1px solid var(--sofis-border);
    margin-top: 4px;
    padding-top: 10px;
    gap: 8px;
  }
  .contratos-table td.col-acoes::before { display: none; }
  /* Sobrescreve inline style do div interno — sem wrap para manter tudo em linha */
  .contratos-table td.col-acoes > div {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: auto !important;
  }
  .contratos-table td.col-acoes .btn-icon { width: 44px !important; height: 44px !important; }

  /* Campos ocultados em mobile */
  .contratos-table td.col-cnpj,
  .contratos-table td.col-classificacao,
  .contratos-table td.col-nova-neg { display: none; }

  /* Alinhamento do valor MRR à direita */
  .contratos-table td.cell-num { font-weight: 600; }

  /* Badge de status: sem label-antes */
  .contratos-table td:has(.badge)::before { display: none; }

  /* Tabela de info fica normal */
  .table-info { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* ── Modais: bottom sheet ────────────────────────────────────── */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-overlay.modal-pdf-overlay {
    align-items: center;
    padding: 12px;
  }

  .modal-box {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
  }

  .modal-header { padding: 14px 16px 10px; }

  .modal-box > form,
  .modal-body { padding: 16px; }

  .form-grid-2 { grid-template-columns: 1fr; }

  .modal-footer,
  .modal-box form > div[style*="justify-content:flex-end"],
  .modal-box form > div[style*="justify-content: flex-end"] {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn,
  .modal-box form .btn { width: 100%; justify-content: center; }

  /* Modal PDF: fullscreen mesmo em mobile */
  .modal-pdf-box {
    width: 100%;
    max-width: 100%;
    height: 88vh;
    border-radius: 20px 20px 0 0;
  }
}

/* ── Evolução: seletores empilhados ─────────────────────────── */
@media (max-width: 600px) {
  .evol-header-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .evol-competencia-wrap { flex-direction: column; gap: 8px; }
  .evol-comp-sep { display: none; }
  .evol-comp-select { width: 100%; }
  .evol-comp-group { width: 100%; }

  .evol-movers-grid { grid-template-columns: 1fr; }
}

/* ── Produtos: matriz com scroll ─────────────────────────────── */
@media (max-width: 768px) {
  .matriz-container {
    margin: 0 !important;
    overflow-x: scroll !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: var(--r-md);
    max-height: 70vh;
  }
  /* Desativa sticky horizontal no mobile (quebra no Android Chrome) */
  .matriz-table thead tr th:first-child,
  .matriz-table tbody tr td:first-child,
  .matriz-table tfoot tr td:first-child {
    position: relative !important;
    left: auto !important;
  }
  /* Sticky vertical do header também deve ser desabilitado pois depende do sticky horizontal */
  .matriz-table thead tr th {
    position: relative !important;
    top: auto !important;
  }
}

@media (max-width: 480px) {
  .prod-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Produtos: controles da matriz no mobile ────────────────── */
@media (max-width: 600px) {
  .prod-chart-wrap { padding: 16px 14px; }

  /* Título + info de contagem empilham verticalmente */
  .prod-section-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* Barra de busca + legenda empilham verticalmente */
  .matriz-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Campo de busca ocupa toda a largura */
  .matriz-search { width: 100%; }
  .matriz-search input { width: 100%; flex: 1; box-sizing: border-box; }

  /* Legenda ("Possui produto" / "Oportunidade") quebra naturalmente */
  .matriz-header > div { flex-wrap: wrap; gap: 10px !important; }
}

/* ── Mapa do Brasil: stack vertical ──────────────────────────── */
@media (max-width: 700px) {
  .mapa-layout { flex-direction: column; }
  .mapa-detalhes { width: 100%; }
}

/* ── Visão do cliente: bottom sheet ─────────────────────────── */
@media (max-width: 600px) {
  .cv-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .cv-box {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
  }
  .cv-header { padding: 16px; }
  .cv-nome-fantasia { font-size: 1.3rem; }
  .cv-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Financeiro: charts em mobile ───────────────────────────── */
@media (max-width: 600px) {
  .chart-canvas-wrap,
  .chart-canvas-sm { height: 160px !important; }
}

/* ── KPI cards globais: 2 colunas em mobile ──────────────────── */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .evol-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Modal clientes por produto ──────────────────────────────── */
.modal-clientes-prod {
  max-width: 520px;
  padding: 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-clientes-lista {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mcp-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--sofis-border);
  background: var(--sofis-card, #fff);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mcp-card:hover {
  border-color: var(--sofis-teal);
  box-shadow: 0 2px 8px rgba(80,124,140,0.12);
}
.mcp-card-info { flex: 1; min-width: 0; }
.mcp-nome {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--sofis-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.mcp-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.mcp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  background: var(--sofis-lightbg);
  border: 1px solid var(--sofis-border);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--sofis-dark);
}
.mcp-pill em {
  font-style: normal;
  color: var(--sofis-teal);
  font-weight: 600;
}
.mcp-mrr {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sofis-teal);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-danger-outline {
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-danger-outline:hover {
  background: #fff1f1;
  border-color: #dc2626;
}

/* ── Barra de toggle compartilhada (MRR + Matriz) ─────────────── */
.prod-view-toggle-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ── Toggle Detalhado/Agrupado ───────────────────────────────── */
.prod-view-toggle {
  display: flex;
  border: 1px solid var(--sofis-border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.prod-toggle-btn {
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.prod-toggle-btn:hover { background: var(--sofis-lightbg); color: var(--sofis-dark); }
.prod-toggle-btn.prod-toggle-active {
  background: var(--sofis-teal);
  color: #fff;
}

/* ── Campo S3 no formulário ──────────────────────────────────── */
.s3-field-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.s3-display-input {
  flex: 1;
  background: var(--sofis-lightbg);
  cursor: default;
  color: var(--sofis-dark);
  font-size: 0.82rem;
}
.btn-s3-nav {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 0 12px;
  height: 36px;
  gap: 5px;
}

/* ── Spinner do modal PDF ────────────────────────────────────── */
.pdf-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--sofis-border);
  border-top-color: var(--sofis-teal);
  border-radius: 50%;
  animation: pdfSpin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes pdfSpin { to { transform: rotate(360deg); } }

/* ── Explorador S3 ───────────────────────────────────────────── */
.s3-breadcrumb {
  padding: 10px 20px;
  border-bottom: 1px solid var(--sofis-border);
  background: var(--sofis-lightbg);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  flex-shrink: 0;
}
.s3-crumb {
  color: var(--sofis-teal);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 500;
}
.s3-crumb:hover { background: var(--sofis-teal-light, #e0f2f1); }
.s3-crumb-sep { color: var(--text-muted); margin: 0 1px; }
.s3-crumb-atual { color: var(--sofis-dark); font-weight: 600; padding: 2px 4px; }

.s3-lista {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.s3-loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.s3-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  border-bottom: 1px solid transparent;
  transition: background 0.12s;
  font-size: 0.84rem;
}
.s3-item svg { flex-shrink: 0; }

.s3-item-back  { color: var(--sofis-teal); cursor: pointer; }
.s3-item-folder { cursor: pointer; }
.s3-item-pdf   { cursor: pointer; }
.s3-item-other { opacity: 0.45; cursor: not-allowed; }

.s3-item-back:hover,
.s3-item-folder:hover { background: var(--sofis-lightbg); }
.s3-item-pdf:hover {
  background: #fff1f1;
  border-color: #fecaca;
}

.s3-item-nome { flex: 1; word-break: break-all; line-height: 1.3; }
.s3-item-size {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  padding-left: 12px;
}

.s3-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--sofis-border);
  background: var(--sofis-lightbg);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Home — Two-Tone Split Cards ────────────────────────────── */
.home-welcome {
  margin-bottom: 36px;
}
.home-greeting {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}
.home-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

/* Grid dos super cards */
.hcards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Card base */
.hcard {
  background: #ffffff;
  border: 1px solid var(--sofis-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s cubic-bezier(0.4,0,0.2,1),
              transform 0.2s cubic-bezier(0.4,0,0.2,1);
  user-select: none;
}
.hcard:not(.hcard--disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(44,62,80,0.10);
}
.hcard--open {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(44,62,80,0.10);
}
.hcard--disabled {
  cursor: default;
  opacity: 0.65;
  filter: grayscale(0.85);
}

.hcard-badge-construcao {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #64748b;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* Cores por variante — aplicadas via CSS custom property */
.hcard--teal  { --hc-accent: #507C8C; --hc-header-bg: rgba(80,124,140,0.07); --hc-icon-bg: rgba(80,124,140,0.13); --hc-divider: rgba(80,124,140,0.18); }
.hcard--gold  { --hc-accent: #c8830f; --hc-header-bg: rgba(200,131,15,0.07); --hc-icon-bg: rgba(200,131,15,0.13); --hc-divider: rgba(200,131,15,0.18); }
.hcard--indigo{ --hc-accent: #6366f1; --hc-header-bg: rgba(99,102,241,0.06); --hc-icon-bg: rgba(99,102,241,0.11); --hc-divider: rgba(99,102,241,0.14); }

/* Zona de cabeçalho colorida */
.hcard-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 26px;
  background: var(--hc-header-bg);
  transition: background 0.2s;
}
.hcard:not(.hcard--disabled):hover .hcard-header,
.hcard--open .hcard-header {
  background: var(--hc-header-bg);
  filter: brightness(0.96);
}

/* Ícone do módulo */
.hcard-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--hc-icon-bg);
  color: var(--hc-accent);
}

/* Textos do cabeçalho */
.hcard-info {
  flex: 1;
  min-width: 0;
}
.hcard-eyebrow {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--hc-accent);
  opacity: 0.65;
  margin-bottom: 4px;
}
.hcard-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 5px 0;
  letter-spacing: -0.01em;
}
.hcard-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* Chevron / badge de status */
.hcard-chevron {
  flex-shrink: 0;
  color: var(--hc-accent);
  opacity: 0.45;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.2s;
  display: flex;
  align-items: center;
}
.hcard--open .hcard-chevron {
  transform: rotate(180deg);
  opacity: 0.85;
}
.hcard-badge-soon {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--hc-icon-bg);
  color: var(--hc-accent);
  border-radius: 20px;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Zona de corpo (subitens) — expandível */
.hcard-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1),
              opacity 0.25s ease,
              padding 0.35s cubic-bezier(0.4,0,0.2,1);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid transparent;
}
.hcard--open .hcard-body {
  max-height: 280px;
  opacity: 1;
  padding: 10px 16px 14px;
  border-top-color: var(--hc-divider);
}

/* Item de submenu */
.hcard-subitem {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 10px;
  border-radius: 10px;
  transition: background 0.15s, transform 0.15s;
  cursor: pointer;
}
.hcard-subitem:hover {
  background: var(--sofis-lightbg);
  transform: translateX(3px);
}

/* Ícone do subitem */
.hcard-subitem-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--hc-icon-bg);
  color: var(--hc-accent);
}

/* Textos do subitem */
.hcard-subitem-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hcard-subitem-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.hcard-subitem-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* Seta do subitem */
.hcard-subitem-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}
.hcard-subitem:hover .hcard-subitem-arrow {
  color: var(--hc-accent);
  transform: translateX(3px);
}

@media (max-width: 768px) {
  .hcards-grid        { grid-template-columns: 1fr; gap: 14px; }
  .hcard-header       { padding: 20px 18px; gap: 13px; }
  .hcard-icon-wrap    { width: 42px; height: 42px; }
  .hcard-title        { font-size: 1.05rem; }
  .home-greeting      { font-size: 1.4rem; }
  .hcard--open .hcard-body { padding: 8px 12px 12px; }
}

/* ================================================================
   TIMES FINANCEIRAS — Custo de Pessoal
   ================================================================ */

/* ── Breadcrumb ──────────────────────────────────────────────── */
.times-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.82rem;
}

.times-breadcrumb .bc-link {
  color: var(--sofis-teal);
  cursor: pointer;
  font-weight: 500;
}

.times-breadcrumb .bc-link:hover { text-decoration: underline; }

.times-breadcrumb .bc-sep {
  color: var(--text-muted);
  margin: 0 2px;
}

.times-breadcrumb .bc-current {
  color: var(--sofis-dark);
  font-weight: 600;
}

/* ── Badge ───────────────────────────────────────────────────── */
.badge-competencia {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  margin-left: 10px;
  vertical-align: middle;
}

.times-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 0.9rem;
}

.times-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* KPI Grid */
.times-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.times-kpi-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.times-kpi {
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
}

.times-kpi.times-kpi-accent {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: rgba(3, 105, 161, 0.18);
}

.times-kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.times-kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--sofis-dark);
  line-height: 1.1;
}

.times-kpi.times-kpi-accent .times-kpi-value { color: #0369a1; }

.times-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Toggle bar */
.times-toggle-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.times-toggle-btn {
  padding: 7px 18px;
  border-radius: 8px;
  border: 1px solid var(--sofis-border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.times-toggle-btn:hover        { background: #f8fafc; color: var(--sofis-dark); }
.times-toggle-btn.times-toggle-active {
  background: var(--sofis-teal);
  color: #fff;
  border-color: var(--sofis-teal);
}

/* Tabela */
.times-tabela-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--sofis-border);
  background: #fff;
}

.times-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.times-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--sofis-border);
  white-space: nowrap;
}

.times-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--sofis-dark);
  vertical-align: middle;
}

.times-table tbody tr:last-child td { border-bottom: none; }

.times-table tfoot td {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 2px solid var(--sofis-border);
  font-size: 0.83rem;
}

.times-table th.num,
.times-table td.num { text-align: right; }

.times-row-click { cursor: pointer; transition: background 0.1s; }
.times-row-click:hover { background: #f0f9ff; }

.times-td-label { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--sofis-dark); }
.times-td-total { font-weight: 600; color: #0369a1; }
.times-td-muted { color: var(--text-muted); font-size: 0.8rem; }
.times-td-arrow { opacity: 0; transition: opacity 0.15s, transform 0.15s; flex-shrink: 0; }
.times-row-click:hover .times-td-arrow { opacity: 0.55; transform: translateX(3px); }

.times-perc {
  display: inline-block;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
}

/* Modal de detalhe — largura maior */
.modal-box-wide  { max-width: 820px; }
.modal-body-scroll {
  max-height: 60vh;
  overflow-y: auto;
}

/* Upload aviso + progresso */
.times-upload-aviso {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 0.82rem;
  color: #92400e;
}

.times-upload-prog {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-muted);
  padding: 4px 0;
}

/* ── Custo com Encargos ───────────────────────────────────────── */
.times-kpi.times-kpi-encargos {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: rgba(22, 163, 74, 0.2);
}
.times-kpi.times-kpi-encargos .times-kpi-value { color: #15803d; }
.times-td-enc { font-weight: 600; color: #15803d; }

/* Breakdown CLT / PJ dentro do card de encargos */
.times-enc-breakdown {
  margin-top: 8px;
  border-top: 1px solid rgba(22,163,74,0.18);
  padding-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.times-enc-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #166534;
  line-height: 1.4;
}

.times-enc-row span:first-child { opacity: 0.75; }
.times-enc-row span:last-child  { font-weight: 600; }

.times-enc-row-pj {
  border-top: 1px solid rgba(22,163,74,0.12);
  padding-top: 3px;
  margin-top: 1px;
  font-weight: 600;
  color: #15803d;
}

/* ── KPI pequeno (visão de time) ─────────────────────────────── */
.times-kpi.times-kpi-sm .times-kpi-value { font-size: 1.15rem; }

/* ── Search bar ──────────────────────────────────────────────── */
.times-search-bar { margin-bottom: 14px; }

.times-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: 10px;
  padding: 9px 14px;
  max-width: 380px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.times-search-wrap:focus-within {
  border-color: var(--sofis-teal);
  box-shadow: 0 0 0 3px rgba(80,124,140,0.12);
}

.times-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--sofis-dark);
}
.times-search-input::placeholder { color: var(--text-muted); }

/* ── Perfil do funcionário ───────────────────────────────────── */
.times-profile { display: flex; flex-direction: column; gap: 20px; }

.times-profile-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: 14px;
  padding: 22px 24px;
}

.times-profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sofis-teal) 0%, #395e6a 100%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.times-profile-name  { font-size: 1.2rem; font-weight: 700; color: var(--sofis-dark); margin: 0 0 3px; }
.times-profile-cargo { font-size: 0.87rem; color: var(--text-muted); margin: 0 0 10px; }

.times-profile-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.times-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}
.times-tag-cc     { background: #eff6ff; color: #1d4ed8; }
.times-tag-regime { background: #f0fdf4; color: #15803d; }
.times-tag-comp   { background: #f8fafc; color: var(--text-muted); }

/* Cards de detalhe */
.times-profile-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.times-profile-card {
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: 12px;
  overflow: hidden;
}

.times-profile-card-title {
  background: #f8fafc;
  border-bottom: 1px solid var(--sofis-border);
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.times-profile-rows { padding: 4px 0; }

.times-profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  font-size: 0.84rem;
  border-bottom: 1px solid #f8fafc;
  gap: 12px;
}
.times-profile-row:last-child { border-bottom: none; }
.times-profile-row > span:first-child { color: var(--text-muted); }
.times-profile-row > span:last-child  { font-weight: 500; color: var(--sofis-dark); }

.times-profile-row-total {
  background: #f8fafc;
  font-weight: 600;
  border-top: 1px solid var(--sofis-border) !important;
}
.times-profile-row-total > span:last-child { color: #0369a1; }

.times-profile-row-sub { background: #fafafa; }
.times-profile-row-sub > span:last-child { font-weight: 700; }

.times-profile-empty {
  padding: 20px 16px;
  font-size: 0.83rem;
  color: var(--text-muted);
  text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.9s linear infinite; }

@media (max-width: 900px) {
  .times-profile-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .times-kpi-grid      { grid-template-columns: repeat(2, 1fr); }
  .times-kpi-grid-4    { grid-template-columns: repeat(2, 1fr); }
  .modal-box-wide      { max-width: 96vw; }
  .times-search-wrap   { max-width: 100%; }
}

/* ============================================================
   PLANEJAMENTO FINANCEIRO
   ============================================================ */

/* Home card — variante emerald */
.hcard--emerald {
  --hc-accent:     #059669;
  --hc-header-bg:  rgba(5,150,105,0.07);
  --hc-icon-bg:    rgba(5,150,105,0.13);
}

/* Status bar */
.pf-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 0.82rem;
}
.pf-status-empty {
  color: var(--text-muted);
  justify-content: space-between;
}
.pf-status-items { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.pf-status-item  { display: flex; align-items: center; gap: 6px; }
.pf-status-label { color: var(--text-muted); }
.pf-status-file  { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-status-actions { display: flex; gap: 8px; }

/* Badges */
.pf-badge-actual  { background:#dcfce7; color:#166534; font-size:0.78rem; padding:2px 8px; border-radius:4px; font-weight:600; }
.pf-badge-plan    { background:#dbeafe; color:#1d4ed8; font-size:0.78rem; padding:2px 8px; border-radius:4px; font-weight:600; }
.pf-badge-forecast{ background:#fef9c3; color:#854d0e; font-size:0.78rem; padding:2px 8px; border-radius:4px; font-weight:600; }

/* Tabs internas do módulo */
.pf-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--sofis-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pf-tab {
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.pf-tab:hover { color: var(--text-main); }
.pf-tab--active { color: #059669; border-bottom-color: #059669; font-weight: 600; }

/* KPI grids */
.pf-kpi-grid   { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.pf-kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.pf-kpi-subs   { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.pf-kpi-sub-item { font-size: 0.72rem; }
.pf-delta-pos  { color: #059669; font-size: 0.78rem; font-weight: 600; }
.pf-delta-neg  { color: #dc2626; font-size: 0.78rem; font-weight: 600; }
.pf-delta-neutral { color: var(--text-muted); font-size: 0.78rem; }

/* Two-col layout */
.pf-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.pf-trend-card { grid-column: 1; }

.pf-chart-legend { display:flex; gap:16px; margin-top:8px; font-size:0.78rem; color:var(--text-muted); }
.pf-legend-actual { color:#059669; font-weight:600; }
.pf-legend-plan   { color:#3b82f6; }

/* P&L table */
.pf-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pf-pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 860px;
}
.pf-pl-table th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--sofis-border);
  white-space: nowrap;
}
.pf-th-label { text-align: left !important; min-width: 200px; }
.pf-pl-table td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid #f0f4f8;
  white-space: nowrap;
}
.pf-td-label { text-align: left !important; }
.pf-pl-row--summary td { font-weight: 700; background: #fafafa; border-top: 1px solid var(--sofis-border); }
.pf-pl-section {
  cursor: pointer;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sofis-dark);
}
.pf-pl-section:hover { background: #e2e8f0; }
.pf-pl-section-label { padding: 8px 12px; display: block; }
.pf-section-arrow { font-size: 0.7rem; margin-right: 6px; }
.pf-pl-subsection { background: #fafcff; }
.pf-pl-sub-label { padding: 6px 12px; display: block; color: var(--text-muted); font-size: 0.8rem; }
.pf-indent-0 td.pf-td-label { padding-left: 12px; }
.pf-indent-1 td.pf-td-label { padding-left: 24px; }
.pf-indent-2 td.pf-td-label { padding-left: 40px; }

/* Mini table */
.pf-mini-table { width: 100%; font-size: 0.83rem; border-collapse: collapse; }
.pf-mini-table th { padding: 6px 10px; background: #f8fafc; font-weight: 600; font-size: 0.78rem; color: var(--text-muted); border-bottom: 1px solid var(--sofis-border); text-align: left; }
.pf-mini-table td { padding: 6px 10px; border-bottom: 1px solid #f0f4f8; }
.pf-mini-table td:last-child { text-align: right; font-weight: 600; }

/* Forecast grid */
.pf-forecast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.pf-scenario-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-scenario-label { font-size: 0.82rem; color: var(--text-muted); }
.pf-select { padding: 5px 10px; border: 1px solid var(--sofis-border); border-radius: var(--r-sm); font-size: 0.82rem; background: #fff; cursor: pointer; }
.pf-select-sm { padding: 3px 8px; border: 1px solid var(--sofis-border); border-radius: var(--r-sm); font-size: 0.78rem; background: #fff; cursor: pointer; }

.pf-forecast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 600px;
}
.pf-forecast-table th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--sofis-border);
  white-space: nowrap;
}
.pf-th-period { min-width: 90px; }
.pf-forecast-table td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid #f0f4f8;
  white-space: nowrap;
}
.pf-row-bold td { font-weight: 700; background: #fafafa; border-top: 1px solid var(--sofis-border); }
.pf-row-pct td { color: #6366f1; }
.pf-cell-editable { cursor: pointer; transition: background 0.15s; }
.pf-cell-editable:hover { background: rgba(5,150,105,0.07) !important; }
.pf-adj-dot { color: #059669; font-size: 0.65rem; margin-left: 3px; vertical-align: super; }

/* Adjustments panel */
.pf-adjustments-panel {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--sofis-border);
}
.pf-adj-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 12px; color: var(--text-main); }
.pf-adj-empty { font-size: 0.82rem; color: var(--text-muted); padding: 8px 0; }

/* Dataset cards */
.pf-datasets-list { display: flex; flex-direction: column; gap: 10px; }
.pf-dataset-card {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
}
.pf-dataset-active  { border-color: #059669; box-shadow: 0 0 0 1px rgba(5,150,105,0.2); }
.pf-dataset-archived { opacity: 0.7; }
.pf-dataset-header  { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.pf-dataset-meta    { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.pf-ds-badge        { font-size: 0.72rem; padding: 1px 7px; border-radius: 4px; font-weight: 600; margin-left: 8px; }
.pf-ds-badge--active   { background: #dcfce7; color: #166534; }
.pf-ds-badge--archived { background: #f1f5f9; color: #64748b; }
.pf-ds-badge--failed   { background: #fee2e2; color: #991b1b; }
.pf-ds-badge--processing { background: #fef9c3; color: #854d0e; }
.pf-ds-warnings     { margin-top: 8px; }
.pf-dataset-actions { margin-top: 8px; display: flex; gap: 8px; }

/* Preview */
.pf-preview-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #f0f4f8; }
.pf-preview-section:last-child { border-bottom: none; }
.pf-preview-section-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; color: var(--text-main); }
.pf-preview-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.83rem; border-bottom: 1px solid #f8fafc; }
.pf-preview-warning { font-size: 0.8rem; color: #92400e; background: #fef3c7; padding: 4px 8px; border-radius: 4px; margin-bottom: 4px; }

/* Upload aviso */
.pf-upload-aviso {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #1e40af;
  margin-top: 10px;
}

/* Form rows */
.pf-form-row { display: flex; gap: 12px; }

/* Empty state */
.pf-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.pf-empty-icon { font-size: 3rem; margin-bottom: 16px; }
.pf-empty-state h3 { font-size: 1.1rem; color: var(--text-main); margin-bottom: 8px; }
.pf-empty-state p { font-size: 0.88rem; margin-bottom: 20px; }

/* Loading */
.pf-loading { padding: 40px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Section header */
.pf-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.pf-section-title  { font-size: 1rem; font-weight: 600; color: var(--text-main); margin: 0; }
.pf-period-label   { font-size: 0.82rem; color: var(--text-muted); }

/* P&L header */
.pf-pl-header { margin-bottom: 14px; }

/* Responsive */
@media (max-width: 1100px) {
  .pf-kpi-grid   { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .pf-kpi-grid   { grid-template-columns: repeat(2, 1fr); }
  .pf-kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .pf-two-col    { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pf-kpi-grid   { grid-template-columns: 1fr 1fr; }
  .pf-kpi-grid-4 { grid-template-columns: 1fr 1fr; }
  .pf-tab        { padding: 7px 10px; font-size: 0.78rem; }
}

/* ── Tabela de Preços ───────────────────────────────────────── */

/* Badges de tipo de preço */
.tp-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; align-items: center; }

.tp-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.tp-badge--governo  { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.tp-badge--normal   { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.tp-badge--especial { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.tp-badge--saas-unica { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.tp-badge--saas-simul { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Calculadora */
.tp-calc-card {
  background: #fff; border: 1px solid var(--sofis-border);
  border-radius: 12px; margin-bottom: 28px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tp-calc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--sofis-teal) 0%, var(--sofis-darkteal) 100%);
  color: #fff; font-weight: 600; font-size: 0.95rem;
}
.tp-calc-hint {
  font-size: 0.78rem; color: rgba(255,255,255,0.7); margin-left: auto; font-weight: 400;
}
.tp-calc-body { padding: 0; }

/* Layout desktop: itens à esquerda, resumo à direita */
.tp-calc-layout {
  display: flex;
  align-items: stretch;
  min-height: 200px;
}
.tp-calc-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tp-calc-right {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--sofis-border);
  display: flex;
  flex-direction: column;
}
#tpCartTotal {
  display: flex;
  flex-direction: column;
}

/* Cabeçalho do painel de resumo */
.tp-total-header {
  padding: 12px 16px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  border-bottom: 1px solid var(--sofis-border);
}

/* Placeholder quando sem produto selecionado */
.tp-cart-total--placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  color: #9ca3af;
  font-size: 0.82rem;
  text-align: center;
}

/* Grupos recorrente / não recorrente no painel lateral */
.tp-total-groups { display: flex; flex-direction: column; }
.tp-total-group  { padding: 12px 16px; border-bottom: 1px solid var(--sofis-border); }
.tp-total-group:last-child { border-bottom: none; }
.tp-total-group-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 8px; flex-wrap: wrap;
}
.tp-total-group-sum {
  font-size: 0.95rem; font-weight: 700; color: var(--sofis-dark); white-space: nowrap;
}
.tp-total-group-periodo {
  font-size: 0.72rem; font-weight: 400; color: #9ca3af;
}
.tp-total-rows { display: flex; flex-direction: column; gap: 3px; }
.tp-total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: #6b7280; gap: 6px;
}
.tp-total-row span:first-child { flex: 1; }
.tp-total-row span:last-child  { font-weight: 500; white-space: nowrap; }

/* Barra de total geral */
.tp-total-grand {
  background: linear-gradient(135deg, var(--sofis-teal) 0%, var(--sofis-darkteal) 100%);
  color: #fff;
}
.tp-total-grand-inner { padding: 14px 16px; }
.tp-total-grand-split { display: flex; flex-direction: column; gap: 4px; }
.tp-total-grand-split > div { display: flex; align-items: baseline; gap: 4px; }
.tp-total-grand-val   { font-size: 1rem; font-weight: 700; }
.tp-total-grand-label { font-size: 0.72rem; opacity: 0.75; }
.tp-total-grand-plus  { font-size: 0.8rem; opacity: 0.5; padding: 2px 0; }

/* Grupos de campo */
.tp-calc-group { display: flex; flex-direction: column; gap: 5px; min-width: 160px; flex: 1; }
.tp-calc-group--sm { min-width: 120px; flex: 0 0 140px; }
.tp-calc-group--xs { min-width: 90px;  flex: 0 0 110px; }
.tp-calc-label { font-size: 0.72rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.tp-calc-select, .tp-calc-input {
  padding: 8px 11px; border: 1px solid var(--sofis-border);
  border-radius: 8px; font-size: 0.86rem; color: var(--sofis-dark);
  background: #fff; outline: none; transition: border-color .15s; width: 100%; box-sizing: border-box;
}
.tp-calc-select:focus, .tp-calc-input:focus { border-color: var(--sofis-teal); box-shadow: 0 0 0 3px rgba(80,124,140,0.12); }

/* Itens do carrinho */
.tp-cart-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px; border-bottom: 1px solid var(--sofis-border);
  position: relative;
}
.tp-cart-item:last-of-type { border-bottom: none; }
.tp-cart-item-num {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--sofis-lightbg); border: 1px solid var(--sofis-border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--sofis-teal); margin-top: 22px;
}
.tp-cart-item-body { flex: 1; min-width: 0; }
.tp-cart-item-fields {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 0;
}
.tp-cart-remove {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 1px solid var(--sofis-border);
  border-radius: 6px; padding: 5px; cursor: pointer;
  color: #9ca3af; line-height: 0; transition: all .15s;
}
.tp-cart-remove:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* Breakdown */
.tp-breakdown {
  margin-top: 10px; background: var(--sofis-lightbg);
  border: 1px solid var(--sofis-border); border-radius: 8px;
  padding: 10px 14px; font-size: 0.83rem;
}
.tp-breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; color: #374151; gap: 8px;
}
.tp-breakdown-row span:first-child { color: #6b7280; flex: 1; }
.tp-breakdown-row span:last-child  { font-weight: 600; white-space: nowrap; }
.tp-breakdown-unit { font-size: 0.75rem; color: #9ca3af; font-weight: 400; }
.tp-bd-tipo { font-weight: 600; color: var(--sofis-teal); }
.tp-breakdown-subtotal {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0 2px; margin-top: 6px;
  border-top: 1px solid var(--sofis-border);
  font-weight: 700; font-size: 0.9rem; color: var(--sofis-dark);
}
.tp-breakdown-subtotal span:last-child { color: var(--sofis-teal); font-size: 1rem; }
.tp-breakdown-isento { color: #9ca3af; font-style: italic; text-align: center; padding: 4px 0; }

/* Botão adicionar */
.tp-cart-add {
  padding: 14px 20px; border-top: 1px solid var(--sofis-border);
  background: var(--sofis-lightbg);
}

/* Total geral */
.tp-cart-total {
  border-top: 2px solid var(--sofis-teal);
  background: #fff;
}
/* Seções de tabelas */
.tp-sections { display: flex; flex-direction: column; gap: 24px; }

.tp-section {
  background: #fff; border: 1px solid var(--sofis-border);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tp-section-header {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--sofis-border);
  background: var(--sofis-lightbg);
}
.tp-section-num {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--sofis-teal); color: #fff;
  font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tp-section-title { font-size: 1rem; font-weight: 700; color: var(--sofis-dark); margin: 0 0 2px; }
.tp-section-sub   { font-size: 0.82rem; color: #6b7280; margin: 0; }
.tp-section-note  { font-size: 0.78rem; color: #9ca3af; margin: 8px 20px 12px; }

/* Tabela de preços */
.tp-table th,
.tp-table td { vertical-align: middle; }
.tp-table thead th.tp-col-price { text-align: right; }
.tp-col-produto { width: 45%; }
.tp-col-price {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 500; color: var(--sofis-dark);
  white-space: nowrap;
}
.tp-price-highlight { font-weight: 700; color: var(--sofis-teal); }
.tp-example        { color: #9ca3af; font-size: 0.82rem; }
.tp-isento         { color: #9ca3af; font-style: italic; font-weight: 400; }
.tp-once           { font-size: 0.75rem; color: #9ca3af; font-weight: 400; margin-left: 4px; }

.tp-row-ativacao td { background: #fffbeb; color: #78350f; }
.tp-row-especial td { background: #f0fdf4; }

/* Cards para seção de preço fixo (Agendamento) */
.tp-fixo-grid {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 20px;
}
.tp-fixo-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--sofis-lightbg); border: 1px solid var(--sofis-border);
  border-radius: 10px; padding: 20px 32px; flex: 1; min-width: 160px;
}
.tp-fixo-card--ativacao { background: #fffbeb; border-color: #fde68a; }
.tp-fixo-label { font-size: 0.75rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.tp-fixo-value { font-size: 1.5rem; font-weight: 800; color: var(--sofis-teal); }
.tp-fixo-card--ativacao .tp-fixo-value { color: #92400e; }
.tp-fixo-sub   { font-size: 0.78rem; color: #9ca3af; }

/* Nota informativa SAAS */
.tp-saas-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 20px 0; padding: 10px 14px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  font-size: 0.82rem; color: #1e40af; line-height: 1.5;
}
.tp-saas-note svg { flex-shrink: 0; margin-top: 1px; }

/* Responsivo */
@media (max-width: 800px) {
  /* No mobile: layout vira coluna (itens em cima, resumo embaixo) */
  .tp-calc-layout  { flex-direction: column; }
  .tp-calc-right   { width: 100%; border-left: none; border-top: 2px solid var(--sofis-teal); }
  .tp-total-groups { flex-direction: row; flex-wrap: wrap; }
  .tp-total-group  { flex: 1; min-width: 180px; border-right: 1px solid var(--sofis-border); border-bottom: none; }
  .tp-total-group:last-child { border-right: none; }
  .tp-total-grand-split { flex-direction: row; gap: 10px; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 700px) {
  .tp-cart-item-fields { flex-direction: column; }
  .tp-calc-group--sm, .tp-calc-group--xs { flex: 1; min-width: 0; }
  .tp-col-produto { width: auto; }
  .tp-cart-item { padding: 14px; }
  .tp-cart-remove { position: static; margin-left: auto; }
  .tp-cart-item { flex-wrap: wrap; }
  .tp-cart-item-num { margin-top: 0; }
  .tp-total-groups { flex-direction: column; }
  .tp-total-group  { border-right: none; border-bottom: 1px solid var(--sofis-border); }
}

/* ============================================================
   DEALS HUBSPOT (superadmin)
   ============================================================ */
.hcard--violet {
  --hc-accent:     #7c3aed;
  --hc-header-bg:  rgba(124,58,237,0.06);
  --hc-icon-bg:    rgba(124,58,237,0.11);
  --hc-divider:    rgba(124,58,237,0.14);
}

.hcard--azure {
  --hc-accent:     #0078d4;
  --hc-header-bg:  rgba(0,120,212,0.06);
  --hc-icon-bg:    rgba(0,120,212,0.11);
  --hc-divider:    rgba(0,120,212,0.14);
}

.deals-chip {
  align-self: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(80,124,140,0.12);
  color: var(--sofis-darkteal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.deals-chip:empty { display: none; }

/* Filtros */
.deals-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.deals-seg {
  display: inline-flex;
  padding: 3px;
  background: #e9eff2;
  border-radius: var(--r-md);
}
.deals-seg-btn {
  border: 0;
  background: transparent;
  padding: 7px 18px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.deals-seg-btn.active {
  background: var(--bg-white);
  color: var(--sofis-dark);
  box-shadow: var(--shadow-sm);
}
.deals-filtros select {
  padding: 9px 34px 9px 14px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  background-color: var(--bg-white);
  color: var(--text-main);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.deals-filtros select:focus-visible,
.deals-busca:focus-visible,
.deals-seg-btn:focus-visible { outline: 2px solid var(--sofis-teal); outline-offset: 1px; }

.deals-intervalo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.deals-intervalo input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  background-color: var(--bg-white);
  color: var(--text-main);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
}
.deals-intervalo input[type="date"]:focus-visible { outline: 2px solid var(--sofis-teal); outline-offset: 1px; }
.deals-intervalo-sep { font-size: 0.8rem; color: var(--text-faint); }

/* KPIs executivos */
.deals-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.deals-kpi {
  position: relative;
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.deals-kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.deals-kpi-value {
  margin-top: 8px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--sofis-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deals-kpi-sub {
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deals-kpi--hero {
  background: linear-gradient(135deg, var(--sofis-dark) 0%, var(--sofis-darkteal) 100%);
  border-color: transparent;
}
.deals-kpi--hero .deals-kpi-label { color: rgba(255,255,255,0.7); }
.deals-kpi--hero .deals-kpi-value { color: #fff; }
.deals-kpi--hero .deals-kpi-sub   { color: rgba(255,255,255,0.65); }

/* Variante verde — usada no card hero de MRR/ARR Ganho (receita já realizada) */
.deals-kpi--hero.deals-kpi--won {
  background: linear-gradient(135deg, #0f5132 0%, #146c43 100%);
}

/* Cabeçalho de cada bloco da tela (Resultados Fechados / Pipeline em Aberto) */
.deals-section { margin-bottom: 34px; }
.deals-section-head { margin-bottom: 16px; }
.deals-section-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.deals-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--sofis-dark);
}

/* Painéis de barras */
.deals-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.deals-panels--single { grid-template-columns: minmax(280px, 460px); }
.deals-panel {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.deals-panel h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.deals-bar { margin-bottom: 11px; }
.deals-bar:last-child { margin-bottom: 0; }
.deals-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  margin-bottom: 4px;
}
.deals-bar-name {
  color: var(--text-main);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deals-bar-val {
  color: var(--sofis-dark);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deals-bar-track { height: 7px; background: #eef2f5; border-radius: 999px; overflow: hidden; }
.deals-bar-fill  { height: 100%; background: var(--sofis-teal); border-radius: 999px; min-width: 3px; }
.deals-panel-vazio { font-size: 0.8rem; color: var(--text-faint); padding: 8px 0; }

/* Tabela */
.deals-card {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.deals-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sofis-border);
}
.deals-card-title { font-size: 0.95rem; font-weight: 700; color: var(--sofis-dark); }
.deals-card-sub   { font-size: 0.75rem; color: var(--text-faint); }
.deals-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.deals-busca {
  width: 300px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  background: var(--sofis-lightbg);
  font: inherit;
  font-size: 0.83rem;
  color: var(--text-main);
}
.deals-table-scroll { overflow-x: auto; }
.deals-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; min-width: 820px; }
.deals-table thead th {
  position: sticky;
  top: 0;
  background: var(--sofis-lightbg);
  padding: 11px 20px;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.deals-table thead th:hover { color: var(--sofis-teal); }
.deals-table thead th.asc::after  { content: ' ▲'; font-size: 0.6rem; }
.deals-table thead th.desc::after { content: ' ▼'; font-size: 0.6rem; }
.deals-table th.num, .deals-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deals-table tbody td { padding: 13px 20px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.deals-table tbody tr:hover td { background: #f8fafc; }
.deals-data { color: var(--text-muted); white-space: nowrap; }
.deals-empresa { font-weight: 700; color: var(--sofis-dark); }
.deals-nome { margin-top: 2px; font-size: 0.76rem; color: var(--text-muted); }
.deals-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
}
.deals-link:hover { color: var(--sofis-teal); text-decoration: underline; }
.deals-link svg { flex-shrink: 0; opacity: 0.6; }
.deals-link:hover svg { opacity: 1; }
.deals-mrr { font-weight: 700; color: var(--sofis-darkteal); }
.deals-mrr.zero { font-weight: 400; color: var(--text-faint); }
.deals-owner { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.deals-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(80,124,140,0.15); color: var(--sofis-darkteal);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
}
.deals-stage {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #e9eff2;
  color: var(--text-muted);
}
.deals-stage[data-s="QUALIFICACAO"]  { background: #e8eef5; color: #4a6785; }
.deals-stage[data-s="APRESENTACAO"]  { background: #e1f0f3; color: #2f7284; }
.deals-stage[data-s="PROPOSTA"]      { background: #fdf1d6; color: #9a6a0a; }
.deals-stage[data-s="NEGOCIACAO"]    { background: #dcf3e6; color: #17693f; }
.deals-stage[data-s="GANHO"]         { background: #146c43; color: #fff; }
.deals-total-row td { border-top: 2px solid var(--sofis-border); background: var(--sofis-lightbg); font-weight: 700; color: var(--sofis-dark); }
.deals-vazio { text-align: center; padding: 48px 20px !important; color: var(--text-faint); }

@media (max-width: 700px) {
  .deals-kpi-value { font-size: 1.25rem; }
}

/* Botão liga/desliga "Somente com MRR" */
.deals-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 7px 14px 7px 10px;
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  cursor: pointer;
  user-select: none;
}
.deals-switch input { position: absolute; opacity: 0; pointer-events: none; }
.deals-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background .18s;
  flex-shrink: 0;
}
.deals-switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform .18s;
}
.deals-switch input:checked + .deals-switch-track { background: var(--sofis-teal); }
.deals-switch input:checked + .deals-switch-track::after { transform: translateX(14px); }
.deals-switch input:focus-visible + .deals-switch-track { outline: 2px solid var(--sofis-teal); outline-offset: 2px; }
.deals-switch-label { font-size: 0.82rem; font-weight: 600; color: var(--text-main); }

.deals-bar-qtd {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* ============================================================
   AZURE DEVOPS (superadmin)
   ============================================================ */
.ado-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ado-campo input[type="number"] {
  width: 140px;
  padding: 9px 14px;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-md);
  background: var(--bg-white);
  color: var(--text-main);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.ado-campo input[type="number"]:focus-visible { outline: 2px solid var(--sofis-teal); outline-offset: 1px; }

.deals-kpi--hero.deals-kpi--done { background: linear-gradient(135deg, #0f5132 0%, #146c43 100%); }
.deals-kpi--hero.deals-kpi--pend { background: linear-gradient(135deg, #92400e 0%, #b45309 100%); }

.ado-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.ado-badge[data-b="concluido"] { background: #dcf3e6; color: #17693f; }
.ado-badge[data-b="pendente"]  { background: #fdf1d6; color: #9a6a0a; }
.ado-badge[data-b="removido"] { background: #fbe4e6; color: #9c2733; }

/* Lista de Features com barra de progresso (Azure DevOps) */
.ado-feature-lista {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ado-feature-card {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ado-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  flex-wrap: wrap;
  user-select: none;
}
.ado-feature-head:hover { background: #f8fafc; }
.ado-feature-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--sofis-dark);
  font-size: 0.92rem;
}
.ado-feature-id { font-weight: 600; color: var(--text-faint); font-size: 0.8rem; }
.ado-feature-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.ado-feature-pct { font-weight: 800; font-size: 1.05rem; min-width: 44px; text-align: right; }
.ado-feature-pct--ok   { color: #17693f; }
.ado-feature-pct--warn { color: #9a6a0a; }
.ado-feature-pct--risk { color: #b3261e; }
.ado-feature-chevron { color: var(--text-faint); flex-shrink: 0; transition: transform 0.18s; }
.ado-feature-card.open .ado-feature-chevron { transform: rotate(180deg); }

.ado-progress-track {
  height: 8px;
  background: #eef2f5;
  margin: 0 20px 16px;
  border-radius: 999px;
  overflow: hidden;
}
.ado-progress-fill { height: 100%; border-radius: 999px; transition: width 0.25s; }
.ado-progress-fill--ok   { background: #17693f; }
.ado-progress-fill--warn { background: #c8830f; }
.ado-progress-fill--risk { background: #c0392b; }

.ado-feature-body {
  display: none;
  border-top: 1px solid var(--sofis-border);
  padding: 6px 20px 14px;
}
.ado-feature-card.open .ado-feature-body { display: block; }

.ado-pend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.83rem;
  flex-wrap: wrap;
}
.ado-pend-item:last-child { border-bottom: none; }
.ado-pend-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ado-pend-titulo {
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ado-pend-meta { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.ado-pend-owner { color: var(--text-muted); font-size: 0.78rem; }
.ado-pend-vazio { padding: 10px 0; color: var(--text-faint); font-size: 0.83rem; }

/* ============================================================
   EDITOR DE PERMISSÕES (árvore módulo → página)
   ============================================================ */
.perm-usuario-nome { font-weight: 700; color: var(--sofis-dark); font-size: 0.95rem; margin-bottom: 2px; }
.perm-usuario-sub  { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }

.perm-arvore {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.perm-modulo {
  border-bottom: 1px solid #f1f5f9;
  padding: 8px 0;
}
.perm-modulo:last-child { border-bottom: none; }
.perm-linha {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-main);
}
.perm-linha:hover { background: #f8fafc; }
.perm-linha input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--sofis-teal);
  cursor: pointer;
  flex-shrink: 0;
}
.perm-linha--modulo { font-weight: 700; color: var(--sofis-dark); }
.perm-paginas { margin-left: 26px; display: flex; flex-direction: column; }

/* ============================================================
   CONTROLE DE LICENÇAS
   ============================================================ */
.lic-dica {
  padding: 12px 20px;
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--sofis-lightbg);
  border-bottom: 1px solid var(--sofis-border);
}

.lic-grid-scroll {
  overflow: auto;
  max-height: 560px;
}
.lic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 900px;
}
.lic-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.lic-table thead tr:nth-child(2) th {
  position: sticky;
  top: 27px;
  z-index: 2;
}
.lic-table thead th {
  background: var(--sofis-lightbg);
  padding: 7px 10px;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--sofis-border);
}
.lic-th-grupo {
  text-align: center;
  border-left: 1px solid var(--sofis-border);
  border-bottom: 1px solid var(--sofis-border) !important;
}
.lic-table thead tr:first-child th:nth-child(2) { background: #e1f0f3; color: #2f7284; } /* Em uso */
.lic-table thead tr:first-child th:nth-child(3) { background: #fdf1d6; color: #9a6a0a; } /* Contratadas */
.lic-table thead tr:first-child th:nth-child(4) { background: #eef2f5; color: #475569; } /* Diferença */
.lic-th-mod { text-align: center; border-left: 1px solid var(--sofis-border); }

.lic-table tbody td {
  padding: 7px 10px;
  border-top: 1px solid #f1f5f9;
  vertical-align: middle;
}
.lic-table tbody tr:hover td { background: #f8fafc; }
.lic-local { color: var(--text-main); white-space: nowrap; }
.lic-sede { font-weight: 600; color: var(--sofis-dark); white-space: normal; min-width: 220px; }

.lic-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  border-left: 1px solid #f1f5f9;
}
.lic-cel { padding: 4px 6px; }
.lic-label {
  display: inline-block;
  min-width: 20px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  color: var(--sofis-dark);
}
.lic-label:hover {
  background: rgba(80,124,140,0.12);
  outline: 1px dashed var(--sofis-teal);
}
.lic-input {
  width: 52px;
  padding: 4px 5px;
  text-align: center;
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sofis-dark);
  background: var(--bg-white);
}
.lic-input:focus-visible { outline: 2px solid var(--sofis-teal); outline-offset: 1px; }
.lic-dif--risco { color: #c0392b; font-weight: 700; }
.lic-dif--sobra { color: var(--text-muted); font-weight: 500; }
.lic-cel--salvo { background: #dcf3e6 !important; transition: background 1.2s; }

.lic-secao-row td {
  background: #eef2f5;
  color: var(--sofis-dark);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-top: 1px solid var(--sofis-border);
  border-bottom: 1px solid var(--sofis-border);
}

/* Linha de total do grupo, no topo do resumo por unidade — mesma ideia da
   linha de seção, mas com um tom próprio pra não confundir os dois. */
.lic-total-geral td {
  background: #f5f0fb;
  font-weight: 700;
  border-top: 1px solid var(--sofis-border);
  border-bottom: 2px solid var(--sofis-border);
}
.lic-total-geral .lic-local { color: #6d4a9c; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.lic-total-geral:hover td { background: #f5f0fb; } /* não deixa o hover padrão da tabela clarear essa linha */

.lic-hub-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--sofis-teal);
  cursor: pointer;
  text-align: left;
}
.lic-hub-link:hover { text-decoration: underline; }
.lic-hub-sites { display: block; font-size: 0.7rem; color: var(--text-faint); font-weight: 400; margin-top: 1px; }

.lic-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--sofis-border);
  background: var(--bg-white);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sofis-dark);
  cursor: pointer;
}
.lic-voltar:hover { background: var(--sofis-lightbg); }

.lic-log-wrap {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 20px 18px;
}
.lic-log-hub { margin-bottom: 16px; }
.lic-log-hub:last-child { margin-bottom: 0; }
.lic-log-hub h4 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sofis-darkteal);
  margin-bottom: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--sofis-border);
}
.lic-log-hub:first-child h4 { border-top: none; padding-top: 0; }
.lic-log-item {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 3px 0;
  line-height: 1.5;
}
.lic-log-item--sistema {
  color: var(--text-main);
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 4px;
}

/* Lista de produtos (Contratado x Em Uso x Saldo), no topo da tela */
.lic-resumo-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.lic-resumo-caption b { color: var(--sofis-dark); }

/* Um card só, com todos os produtos dentro — cada um vira uma linha do
   grid interno (2 colunas em telas largas, 1 em telas estreitas). */
.lic-prod-lista {
  background: var(--bg-white);
  border: 1px solid var(--sofis-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px 6px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 28px;
}

.lic-prod-legenda {
  grid-column: 1 / -1;
  display: flex;
  gap: 20px;
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--sofis-border);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.lic-prod-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.lic-prod-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.lic-prod-swatch--contratado { background: #c8830f; }
.lic-prod-swatch--emuso      { background: #2f7284; }

.lic-prod-item {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.lic-prod-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.lic-prod-nome { font-weight: 700; font-size: 0.86rem; color: var(--sofis-dark); }
.lic-prod-saldo { font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.lic-prod-saldo--neg  { color: #c0392b; }
.lic-prod-saldo--pos  { color: var(--text-faint); font-weight: 500; }
.lic-prod-saldo--zero { color: var(--text-faint); font-weight: 500; }

.lic-prod-barra-linha {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}
.lic-prod-barra-linha:last-child { margin-bottom: 0; }
.lic-prod-barra-track {
  flex: 1;
  height: 6px;
  background: #eef2f5;
  border-radius: 999px;
  overflow: hidden;
}
.lic-prod-barra-fill { height: 100%; border-radius: 999px; min-width: 2px; }
.lic-prod-barra-fill--contratado { background: #c8830f; }
.lic-prod-barra-fill--emuso      { background: #2f7284; }
.lic-prod-barra-valor {
  width: 34px;
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
