/* ==========================================================================
   ZAPCONTROLLER - DESIGN SYSTEM & ESTILOS PREMIUM
   ========================================================================== */

:root {
  /* Cores Principais */
  --bg-main: #07090e;
  --bg-sidebar: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(24, 32, 50, 0.9);
  --bg-input: #111726;
  
  /* Acentos & Gradientes */
  --emerald-main: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --violet-main: #6366f1;
  --purple-accent: #8b5cf6;
  --rose-main: #f43f5e;
  --amber-main: #f59e0b;
  --cyan-main: #06b6d4;

  /* Bordas e Sombras */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.5);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.15);

  /* Tipografia & Textos */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Transições */
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset Geral */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
}

/* LAYOUT PRINCIPAL */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.brand-container {
  padding: 0 10px 24px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  text-decoration: none;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--emerald-main), #059669);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px var(--emerald-glow);
}

.logo-text h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text h2 span {
  color: var(--emerald-main);
}

.logo-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* STATUS DA UAZAPI */
.uazapi-status-card {
  margin: 18px 0;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--emerald-main);
  box-shadow: 0 0 10px var(--emerald-main);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.status-info {
  display: flex;
  flex-direction: column;
}

.status-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald-main);
  text-transform: uppercase;
}

.status-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* NAVEGAÇÃO */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
  color: #a5b4fc;
  font-weight: 600;
  border-left: 3px solid var(--violet-main);
}

.nav-icon {
  font-size: 1.15rem;
}

.badge-new {
  margin-left: auto;
  font-size: 0.65rem;
  background: var(--emerald-main);
  color: #000;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.badge-free {
  margin-left: auto;
  font-size: 0.65rem;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* CARD ASSESSOR NA SIDEBAR */
.assessor-sidebar-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assessor-avatar {
  position: relative;
  width: 44px;
  height: 44px;
}

.assessor-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--emerald-main);
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--emerald-main);
  border: 2px solid var(--bg-sidebar);
}

.assessor-meta strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.assessor-meta span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-talk-whatsapp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  color: var(--emerald-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-talk-whatsapp:hover {
  background: var(--emerald-main);
  color: #000;
}

/* ==========================================================================
   CONTEÚDO PRINCIPAL & TOPBAR
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  padding: 24px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 9, 14, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.view-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

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

.btn-action-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--emerald-main), #059669);
  color: #07150f;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px var(--emerald-glow);
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-main), #4338ca);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.profile-info strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.2;
}

.role-badge {
  font-size: 0.68rem;
  color: #a5b4fc;
}

/* ==========================================================================
   VIEWS GERENCIAMENTO
   ========================================================================== */
.views-wrapper {
  padding: 32px 36px;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.view-section.active {
  display: block;
}

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

/* ==========================================================================
   VIEW 1: DASHBOARD
   ========================================================================== */

/* BANNER DE INSIGHT */
.bento-insight-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(16, 185, 129, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.insight-icon {
  font-size: 1.8rem;
}

.insight-text {
  flex: 1;
}

.insight-text strong {
  font-size: 0.95rem;
  color: #e2e8f0;
}

.insight-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-insight-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-insight-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* GRID DE MÉTRICAS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 22px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-card);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-badge.green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-main);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -1px;
  font-family: var(--font-sans);
}

.metric-value.income { color: var(--emerald-main); }
.metric-value.expense { color: var(--rose-main); }

.metric-footer {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* CHARTS SECTION */
.charts-section-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 24px;
}

.dashboard-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 24px;
}

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

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.panel-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-text {
  background: none;
  border: none;
  color: var(--violet-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-text:hover {
  color: #a5b4fc;
}

/* DONUT CHART */
.categories-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.donut-chart-wrapper {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.center-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.center-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* LEGENDA DE CATEGORIAS */
.categories-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

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

.legend-val {
  font-weight: 600;
}

.legend-perc {
  font-size: 0.75rem;
  color: var(--text-dim);
  width: 38px;
  text-align: right;
}

/* LISTA DE ÚLTIMAS TRANSAÇÕES */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: var(--transition);
}

.tx-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tx-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.05);
}

.tx-info strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.tx-info span {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.tx-right {
  text-align: right;
}

.tx-amount {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-sans);
}

.tx-amount.income { color: var(--emerald-main); }
.tx-amount.expense { color: var(--rose-main); }

.tx-method {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ==========================================================================
   VIEW 2: TABELA DE EXTRATO & FILTROS
   ========================================================================== */
.transactions-toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-box input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.filters-group {
  display: flex;
  gap: 12px;
}

.custom-select {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
}

.custom-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.table-responsive {
  overflow-x: auto;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.tx-table th {
  padding: 14px 18px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.tx-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tx-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
}

.btn-del-tx {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-del-tx:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-main);
}

/* ==========================================================================
   VIEW 3: METAS & ORÇAMENTOS
   ========================================================================== */
.budgets-header-box {
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.budgets-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.budgets-header-box h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.budgets-header-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.budget-limit-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.budget-limit-edit input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.budget-limit-edit button {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.admin-create-user-form {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.uazapi-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.admin-uazapi-status {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-persist-banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid #f59e0b55;
  background: #f59e0b18;
  color: #fbbf24;
}

.admin-persist-banner.ok {
  border-color: #22c55e55;
  background: #22c55e15;
  color: #86efac;
}

.admin-persist-banner.danger {
  border-color: #ef444488;
  background: #ef444422;
  color: #fca5a5;
}

.dashboard-panel-inner {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.panel-subtitle {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.wa-connect-state {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.wa-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.wa-qr-wrap.hidden {
  display: none;
}

.wa-qr-wrap img {
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.wa-qr-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 320px;
}

.wa-qr-image-box {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  display: inline-flex;
}

.wa-qr-waiting {
  color: var(--brand-primary, #22c55e);
  font-weight: 500;
  animation: wa-pulse 2s infinite;
}

@keyframes wa-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.wa-setup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.wa-setup-form.hidden {
  display: none;
}

.wa-setup-form .custom-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
}

.wa-instance-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.wa-instance-card.hidden {
  display: none;
}

.wa-status-tag {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.wa-status-tag.connected {
  color: #22c55e;
}

.wa-advanced-details {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wa-advanced-details summary {
  cursor: pointer;
}

.admin-user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-user-actions button {
  font-size: 0.8rem;
  padding: 6px 10px;
}

.budget-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 22px;
}

.budget-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.budget-cat-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
}

.budget-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.budget-status-pill.ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-main);
}

.budget-status-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-main);
}

.budget-status-pill.danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-main);
}

.budget-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.budget-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.budget-meta-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.budget-meta-values strong {
  color: var(--text-main);
}

/* ==========================================================================
   VIEW 4: SIMULADOR DE WHATSAPP (BENTO IA)
   ========================================================================== */
.chat-simulator-container {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: start;
}

.chat-sidebar-info h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.chat-sidebar-info p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

.feature-bullets {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.bullet-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.b-icon {
  font-size: 1.3rem;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.bullet-item strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.bullet-item span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.quick-prompts-box h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.quick-prompts-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-chip {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.quick-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
  transform: translateX(4px);
}

/* CELULAR MOCKUP */
.phone-mockup {
  background: #11141d;
  border: 8px solid #232838;
  border-radius: 36px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  max-width: 390px;
  margin: 0 auto;
  overflow: hidden;
}

.phone-screen {
  background-color: #0b141a;
  background-image: radial-gradient(#1f2c34 1px, transparent 1px);
  background-size: 20px 20px;
  height: 560px;
  display: flex;
  flex-direction: column;
}

/* HEADER DO WHATSAPP */
.wa-header {
  background: #1f2c34;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-contact {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-avatar {
  position: relative;
  width: 38px;
  height: 38px;
}

.wa-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.wa-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid #1f2c34;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.name-row strong {
  font-size: 0.9rem;
  color: #e9edef;
}

.wa-verified {
  background: #25d366;
  color: #000;
  font-size: 0.65rem;
  font-weight: 900;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wa-status-text {
  font-size: 0.72rem;
  color: #8696a0;
}

.wa-header-icons {
  display: flex;
  gap: 14px;
  color: #aebac1;
  font-size: 1.1rem;
}

/* ÁREA DE MENSAGENS */
.wa-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wa-bubble-date {
  align-self: center;
  background: #182229;
  color: #8696a0;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.wa-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}

.wa-bubble p {
  margin-bottom: 6px;
}

.wa-bubble p:last-child {
  margin-bottom: 0;
}

.wa-bubble-incoming {
  align-self: flex-start;
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 2px;
}

.wa-bubble-outgoing {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 2px;
}

.wa-sender {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #25d366;
  margin-bottom: 4px;
}

.wa-time {
  display: block;
  text-align: right;
  font-size: 0.65rem;
  color: #8696a0;
  margin-top: 4px;
}

/* CAMPO DE ENVIAR */
.wa-input-bar {
  background: #202c33;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-icon-btn {
  background: none;
  border: none;
  color: #8696a0;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}

.wa-input-bar input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: #e9edef;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.wa-input-bar input:focus {
  outline: none;
}

.wa-send-btn {
  background: #00a884;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.wa-send-btn:hover {
  background: #06cf9c;
}

/* ==========================================================================
   VIEW 5: PLANOS & PREÇOS
   ========================================================================== */
.pricing-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 40px auto;
}

.pricing-pill {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.pricing-header h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.pricing-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.pricing-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}

.pricing-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card);
}

.pricing-card.featured-card {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.1);
  background: linear-gradient(180deg, rgba(20, 32, 45, 0.9) 0%, rgba(14, 20, 32, 0.9) 100%);
}

.featured-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--emerald-main), #059669);
  color: #03140d;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.plan-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.plan-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.price-display {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 4px;
}

.price-display .currency {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.price-display .amount {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
}

.price-display .cents {
  font-size: 1.4rem;
  font-weight: 700;
}

.price-display .period {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.billing-note {
  font-size: 0.78rem;
  color: var(--emerald-main);
  margin-bottom: 24px;
  display: block;
}

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  flex: 1;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.features-list .chk {
  color: var(--emerald-main);
  font-weight: 800;
}

.btn-plan-select {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.btn-plan-select:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-plan-select.featured {
  background: linear-gradient(135deg, var(--emerald-main), #059669);
  color: #051a11;
  border: none;
  box-shadow: 0 4px 15px var(--emerald-glow);
}

.btn-plan-select.featured:hover {
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

/* ==========================================================================
   VIEW 6: PAINEL ADMINISTRATIVO
   ========================================================================== */
.admin-top-summary {
  margin-bottom: 28px;
}

.admin-badge-banner {
  display: inline-block;
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber-main);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.admin-top-summary h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.admin-top-summary p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.role-select {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
}

.admin-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
}

.kpi-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
}

.kpi-value.green {
  color: var(--emerald-main);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-group input {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-group small {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.webhook-url-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px;
}

.webhook-url-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 8px;
}

.copy-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.copy-input-row input {
  flex: 1;
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--emerald-main);
}

.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

.webhook-url-box small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.ai-status-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  padding: 14px;
}

.alert-icon {
  font-size: 1.3rem;
}

.ai-status-alert strong {
  font-size: 0.88rem;
  color: var(--emerald-main);
  display: block;
}

.ai-status-alert p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL DE LANÇAMENTO MANUAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal-card {
  background: #111726;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.type-toggle-group {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
}

.btn-toggle-type {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-toggle-type.active-expense {
  background: rgba(244, 63, 94, 0.2);
  color: var(--rose-main);
}

.btn-toggle-type.active-income {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.btn-secondary {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.confirm-modal-card {
  max-width: 420px;
}

.confirm-modal-message {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 4px;
}

.btn-danger {
  padding: 10px 18px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
}

/* TOAST NOTIFICAÇÃO */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111726;
  border: 1px solid var(--emerald-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.toast-notification.active {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  background: var(--emerald-main);
  color: #000;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}

.toast-message {
  font-size: 0.88rem;
  font-weight: 500;
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 1024px) {
  .charts-section-grid,
  .chat-simulator-container,
  .admin-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .topbar {
    padding: 16px 20px;
  }

  .views-wrapper {
    padding: 20px 16px;
  }

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

/* ==========================================================================
   LOGIN WHATSAPP
   ========================================================================== */
.app-hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 9, 14, 0.92);
  backdrop-filter: blur(12px);
}

.login-screen.active {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-link {
  margin-bottom: 12px;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-step label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.login-step input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  justify-content: center;
}

.login-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

.login-error {
  margin-top: 16px;
  color: var(--rose-main);
  font-size: 0.85rem;
  text-align: center;
}

.login-error.hidden,
.login-step.hidden,
.login-panel.hidden,
.login-whatsapp-contact.hidden,
.whatsapp-save-banner.hidden {
  display: none;
}

.login-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.login-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.login-tab.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--violet-main);
  color: var(--text-main);
}

.login-panel label + input {
  margin-bottom: 12px;
}

.login-whatsapp-contact {
  margin-top: 20px;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed var(--border-subtle);
  text-align: left;
  font-size: 0.85rem;
}

.login-whatsapp-contact p {
  color: var(--text-muted);
  margin: 6px 0 10px;
}

.login-wa-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.whatsapp-save-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border-subtle);
}

.whatsapp-save-text p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.whatsapp-save-banner .btn-action-primary {
  white-space: nowrap;
  text-decoration: none;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--violet-main);
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  font-size: 0.85rem;
}

.btn-logout {
  margin-left: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-logout:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0;
}
