:root {
  --pink: #EC4899;
  --purple: #A855F7;
  --violet: #7C3AED;
  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --soft: #F9FAFB;
  --sidebar-w: 220px;
  --sidebar-bg: #10122E;
  --sidebar-active: #22225a;
  --sidebar-text: #E2E8F0;
  --sidebar-muted: #94A3B8;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

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

html, body.app-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg) !important;
  color: var(--text) !important;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.main-column {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.mobile-topbar,
.mobile-bottom-nav,
.sidebar-overlay,
.sidebar-close-btn {
  display: none;
}

.sidebar-top {
  display: contents;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  height: 100vh;
  max-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  min-height: 32px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 0;
  background: url("/static/img/oppi-logo.png") center / contain no-repeat;
  position: relative;
  flex-shrink: 0;
  box-shadow: none;
}

.brand-mark::after {
  content: none;
  display: none;
}

.sidebar-brand-text {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  color: #FFFFFF;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  margin: 0 -2px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--sidebar-muted);
  font-weight: 600;
  font-size: 0.86rem;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-link-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  opacity: 0.95;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-whatsapp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #DCFCE7;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-whatsapp-link:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
}

.sidebar-whatsapp-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16A34A;
  flex-shrink: 0;
}

.sidebar-whatsapp-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: #FFFFFF;
}

.sidebar-whatsapp-number {
  display: block;
  font-size: 0.72rem;
  color: #BBF7D0;
  margin-top: 2px;
}

.whatsapp-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: #fff;
  font-size: 1.45rem;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(22, 163, 74, 0.35);
  z-index: 120;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.whatsapp-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(22, 163, 74, 0.42);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #FFFFFF;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
}

.sidebar-logout-form {
  margin: 0;
  padding: 0;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-link-logout {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.sidebar-link-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}

.logout-form .btn {
  padding: 9px 10px;
  font-size: 0.8rem;
  border-radius: 14px;
}

.sidebar .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  border: 1px solid var(--sidebar-border);
}

.sidebar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 32px;
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95rem;
}

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

.panel,
.toolbar-card,
.metric-card,
.chart-card,
.status-card,
.funnel-card,
.actions-card,
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar-card {
  padding: 16px;
  margin-bottom: 16px;
}

.filters-row {
  display: flex;
  gap: 12px;
  align-items: end;
}

.filters-row-main {
  flex-wrap: wrap;
}

.filters-row-search {
  margin-top: 12px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filter-field-sm {
  flex: 1 1 150px;
  max-width: 190px;
}

.filter-field-search {
  flex: 1;
}

.filter-field label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}

.filter-field input,
.filter-field select,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: 42px;
  background: var(--soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.search-wrap {
  position: relative;
}

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

.search-wrap input {
  width: 100%;
  height: 44px;
  padding-left: 38px;
  padding-right: 16px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 16px;
  min-height: 120px;
}

.metric-top {
  margin-bottom: 10px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.metric-icon.tone-pink { background: #FCE7F3; color: #DB2777; }
.metric-icon.tone-orange { background: #FFEDD5; color: #EA580C; }
.metric-icon.tone-purple { background: #F3E8FF; color: #9333EA; }
.metric-icon.tone-violet { background: #EDE9FE; color: #7C3AED; }
.metric-icon.tone-green { background: #DCFCE7; color: #16A34A; }
.metric-icon.tone-blue { background: #DBEAFE; color: #2563EB; }
.metric-icon.tone-indigo { background: #E0E7FF; color: #4F46E5; }

.metric-grid-funnel {
  margin-top: 0;
}

.funnel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.funnel-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  min-height: 96px;
}

.funnel-kpi-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

.funnel-kpi-icon.tone-purple { background: #EDE9FE; color: #6D28D9; }
.funnel-kpi-icon.tone-pink { background: #FCE7F3; color: #DB2777; }
.funnel-kpi-icon.tone-blue { background: #E0E7FF; color: #4F46E5; }
.funnel-kpi-icon.tone-rose { background: #FFE4E6; color: #E11D48; }
.funnel-kpi-icon.tone-green { background: #DCFCE7; color: #16A34A; }

.funnel-kpi-body {
  min-width: 0;
}

.funnel-kpi-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
}

.funnel-kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
  margin-top: 2px;
}

.funnel-kpi-trend {
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.2;
}

.funnel-kpi-trend.up { color: #16A34A; }
.funnel-kpi-trend.down { color: #DC2626; }
.funnel-kpi-trend.flat { color: #9CA3AF; }

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 2px;
  color: var(--text);
}

.metric-note {
  color: #9CA3AF;
  font-size: 0.74rem;
  margin-top: 6px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.overview-grid-secondary {
  grid-template-columns: 1.5fr 1fr;
}

.panel {
  padding: 18px;
}

.section-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.section-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 4px 0 14px;
}

.funnel-layout {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 16px;
  align-items: start;
}

.funnel-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.funnel-step {
  margin: 0 auto;
  min-height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
}

.funnel-step.level-0 { background: linear-gradient(90deg, #7C3AED, #9333EA); }
.funnel-step.level-1 { background: linear-gradient(90deg, #9333EA, #A855F7); }
.funnel-step.level-2 { background: linear-gradient(90deg, #A855F7, #C026D3); }
.funnel-step.level-3 { background: linear-gradient(90deg, #C026D3, #EC4899); }
.funnel-step.level-4 { background: linear-gradient(90deg, #EC4899, #F472B6); }

.funnel-horizontal {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel-horizontal-row {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 12px;
  align-items: center;
}

.funnel-horizontal-bar {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: width 0.25s ease, transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.funnel-horizontal-bar:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.funnel-horizontal-bar.is-active {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.funnel-stage-filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.funnel-horizontal-bar.level-0 { background: linear-gradient(90deg, #7C3AED, #9333EA); }
.funnel-horizontal-bar.level-1 { background: linear-gradient(90deg, #EC4899, #F472B6); }
.funnel-horizontal-bar.level-2 { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.funnel-horizontal-bar.level-3 { background: linear-gradient(90deg, #22C55E, #4ADE80); }
.funnel-horizontal-bar.level-4 { background: linear-gradient(90deg, #F97316, #FB923C); }
.funnel-horizontal-bar.level-5 { background: linear-gradient(90deg, #EF4444, #F87171); }

.funnel-horizontal-rate {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
  text-align: right;
}

.funnel-horizontal-rate.muted {
  color: var(--muted);
  font-weight: 600;
}

.funnel-page-chart {
  min-height: 360px;
}

.funnel-plotly-chart {
  width: 100%;
  min-height: 340px;
}

.funnel-charts-grid {
  margin-bottom: 18px;
}

.funnel-leads-panel {
  margin-top: 18px;
}

.funnel-leads-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.funnel-leads-filters {
  margin: 0 0 14px;
  box-shadow: none;
}

.funnel-leads-filters .filters-row-main {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}

.funnel-leads-filters .filter-field-sm {
  min-width: 140px;
  flex: 0 0 auto;
}

.funnel-leads-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.funnel-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: #F3F4F6;
  gap: 4px;
}

.funnel-tab {
  border: 0;
  background: transparent;
  color: #6B7280;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.funnel-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.funnel-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #EEF2FF;
  color: #3730A3;
  font-weight: 600;
  font-size: 0.88rem;
}

.funnel-selection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.funnel-select-col {
  width: 42px;
  text-align: center;
}

.funnel-leads-table .table-company-name {
  font-weight: 700;
  color: var(--text);
}

.funnel-leads-table a.table-company-link {
  text-decoration: none;
  color: inherit;
}

.funnel-leads-table a.table-company-link:hover {
  color: var(--primary, #5b4dff);
  text-decoration: underline;
}

.funnel-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.funnel-pagination .leads-pagination-pages {
  display: flex;
  gap: 6px;
}

.funnel-pagination .page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid #E5E7EB;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}

.funnel-pagination .page-btn.active {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #fff;
}

.funnel-pagination .leads-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.funnel-conversions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
}

.funnel-conversion {
  font-size: 0.76rem;
  color: var(--muted);
}

.funnel-conversion strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 2px;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--soft);
}

.action-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.action-dot.action-purple { background: #9333EA; }
.action-dot.action-pink { background: #EC4899; }
.action-dot.action-indigo { background: #6366F1; }
.action-dot.action-rose { background: #F472B6; }
.action-dot.action-green { background: #22C55E; }

.action-label {
  font-size: 0.86rem;
  font-weight: 600;
}

.action-count {
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--violet);
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-count { font-weight: 800; }
.status-percent { color: var(--muted); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-company {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.table-company-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3E8FF;
  color: var(--violet);
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.stage-badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #F3E8FF;
  color: #7C3AED;
}

.stage-badge.proposta { background: #FCE7F3; color: #DB2777; }
.stage-badge.fechado { background: #DCFCE7; color: #16A34A; }
.stage-badge.perdido { background: #FEE2E2; color: #B91C1C; }
.stage-badge.reuniao { background: #EDE9FE; color: #6D28D9; }
.stage-badge.qualificacao { background: #DBEAFE; color: #2563EB; }
.stage-badge.novo-lead { background: #F3E8FF; color: #7C3AED; }

.btn, button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--input-radius, 12px);
  padding: 10px 16px;
  font-family: inherit;
  font-weight: var(--font-bold, 700);
  font-size: var(--text-base, 0.9rem);
  cursor: pointer;
  background: linear-gradient(90deg, #EC4899, #A855F7);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-block { width: 100%; }
.btn-small { padding: 7px 12px; font-size: 0.78rem; }

.alert-success, .alert-error {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.alert-success {
  background: #ECFDF3;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.alert-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
}

.panel-footer-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: var(--violet);
  font-weight: 700;
  font-size: 0.88rem;
}

.empty-note {
  color: var(--muted);
  margin-top: 12px;
}

.copy-btn {
  background: #F3E8FF;
  color: #7C3AED;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .funnel-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .overview-grid,
  .overview-grid-secondary { grid-template-columns: 1fr; }
  .funnel-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .main-column {
    margin-left: 0;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 90;
    min-height: 56px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    color: #fff;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }

  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #F8FAFC;
    position: relative;
  }

  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .mobile-menu-icon::before { top: -6px; }
  .mobile-menu-icon::after { top: 6px; }

  .mobile-topbar-brand {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    min-width: 0;
  }

  .mobile-topbar-mark {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .mobile-topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
  }

  .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    min-height: 64px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: #FFFFFF;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(17, 24, 39, 0.06);
  }

  .mobile-bottom-link {
    flex: 1 1 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 6px 2px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-bottom-link.active {
    color: var(--violet);
    background: rgba(124, 58, 237, 0.08);
  }

  .mobile-bottom-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .mobile-bottom-label {
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mobile-bottom-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    margin-left: 0;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
  }

  .whatsapp-fab {
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .page-back-bar {
    margin-bottom: 10px;
  }

  .page-back-btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 8px;
    flex-shrink: 0;
  }

  .sidebar-top .sidebar-brand {
    padding-bottom: 0;
    min-width: 0;
  }

  .sidebar-link {
    min-height: 46px;
    padding: 12px 14px;
    font-size: 0.95rem;
    gap: 12px;
  }

  .sidebar-link-icon {
    width: 24px;
    font-size: 1.15rem;
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--sidebar-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;
    width: min(290px, 88vw);
    min-width: 0;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.18);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-logout-form {
    margin-top: 4px;
    padding-top: 8px;
  }

  .sidebar-whatsapp-link {
    display: none;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 8px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main-content {
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-title {
    font-size: 1.45rem;
  }

  .page-subtitle {
    font-size: 0.88rem;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-actions .btn,
  .page-actions form {
    flex: 1 1 auto;
  }

  .page-actions .btn {
    justify-content: center;
    min-height: 42px;
  }

  .metric-grid,
  .funnel-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card,
  .funnel-kpi-card {
    min-height: auto;
    padding: 14px;
  }

  .funnel-kpi-value,
  .metric-value {
    font-size: 1.35rem;
  }

  .filters-row,
  .filters-row-main {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-field-sm {
    max-width: none;
    flex: 1 1 100%;
  }

  .toolbar-card {
    padding: 14px;
  }

  .panel {
    padding: 14px;
  }

  .data-table {
    min-width: 620px;
  }

  .panel:has(> .data-table),
  .panel-card:has(> .data-table),
  .panel-card:has(.data-table),
  .activities-table-card,
  .contracts-table-card,
  .settings-table-wrap,
  .table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-heading {
    font-size: 0.95rem;
  }

  .btn {
    min-height: 40px;
  }

  .funnel-horizontal {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .funnel-horizontal-row {
    min-width: 520px;
  }

  .funnel-page-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.att-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #25D366;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

@media (max-width: 640px) {
  /* Mantém KPIs em grade (como no desktop), não empilhados em 1 coluna */
  .metric-grid,
  .funnel-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .funnel-kpi-card {
    align-items: center;
    gap: 10px;
    padding: 12px;
    min-height: 0;
  }

  .funnel-kpi-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1rem;
  }

  .funnel-kpi-label {
    font-size: 0.72rem;
  }

  .funnel-kpi-value {
    font-size: 1.25rem;
  }

  .funnel-kpi-trend {
    font-size: 0.68rem;
  }

  .page-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .page-actions .btn {
    width: auto;
    flex: 1 1 calc(50% - 6px);
  }

  .filters-row-search .search-wrap input {
    font-size: 16px;
  }

  .filter-field input,
  .filter-field select,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
  }
}
