/* URSA workspace: neutral surfaces, graphite actions and readable conversations. */
body.graphite-theme {
  --bg-base: #f5f5f7;
  --bg-surface: #ffffff;
  --border-subtle: #e5e5ea;
  --text-muted: #86868b;
  background: #f5f5f7 !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", Inter, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}
body.graphite-theme .app-container,
body.graphite-theme .main-content { background: #f5f5f7 !important; }
/* Apple & Instagram Clean White Sidebar */
body.graphite-theme .sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e5e5ea !important;
}
body.graphite-theme .sidebar.collapsed {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  padding: 12px 6px !important;
  background: #ffffff !important;
  border-right: 1px solid #e5e5ea !important;
}
body.graphite-theme .sidebar-header {
  padding: 20px 16px 14px 16px !important;
  border-bottom: 1px solid #f2f2f7 !important;
}
body.graphite-theme .brand-info h2 {
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: #1d1d1f !important;
}
body.graphite-theme .brand-caption {
  color: #86868b !important;
}
body.graphite-theme .sidebar-group-label {
  color: #86868b !important;
}
body.graphite-theme .nav-item {
  color: #424245 !important;
  min-height: 40px !important;
  border-radius: 9px !important;
}
body.graphite-theme .nav-item:hover {
  background: #f5f5f7 !important;
  color: #1d1d1f !important;
}
body.graphite-theme .nav-item.active {
  background: #f5f5f7 !important;
  color: #1d1d1f !important;
  font-weight: 600 !important;
  box-shadow: inset 0 0 0 1px #e5e5ea !important;
}
body.graphite-theme .nav-item.active .sidebar-item-icon {
  color: #ff9500 !important;
}
body.graphite-theme .sidebar-item-icon {
  color: #86868b !important;
}
/* Apple macOS Translucent Unified Toolbar */
body.graphite-theme .top-header {
  background: rgba(255, 255, 255, 0.82) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  padding: 10px 24px !important;
  gap: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}
body.graphite-theme :is(.card,.modal-card) {
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: 18px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}
body.graphite-theme :is(.btn,.btn-action-light,.btn-outline) {
  border-radius: 9999px !important;
}
body.graphite-theme :is(button,a,input,select,textarea,[tabindex]):focus-visible {
  outline: 2px solid #0071e3 !important;
  outline-offset: 2px !important;
}
body.graphite-theme button {
  transition: all .16s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* A distinct navigation surface alongside a quiet, spacious message canvas (Apple HIG White) */
body.graphite-theme .inbox-grid { background: #ffffff !important; gap: 0; }
body.graphite-theme .conv-sidebar {
  width: 360px !important; min-width: 300px !important;
  background: #ffffff !important; border-right: 1px solid #e5e5ea !important;
}
body.graphite-theme .conv-header { background: #ffffff; padding: 22px 18px 14px; border-bottom: 1px solid #f2f2f7; }
.workspace-heading { display: flex; flex-direction: column; gap: 4px; }
.workspace-eyebrow { font-size: 9px; font-weight: 650; letter-spacing: .14em; color: #86868b; text-transform: uppercase; }
body.graphite-theme .conv-title-wrap h3 { font-size: 22px !important; font-weight: 700 !important; letter-spacing: -.03em !important; color: #1d1d1f !important; }
body.graphite-theme .conv-header-top { margin-bottom: 16px; }
body.graphite-theme .search-conv-box { background: #f5f5f7; border: 1px solid #e5e5ea; border-radius: 10px; transition: border-color 0.15s ease, background 0.15s ease; }
body.graphite-theme .search-conv-box:focus-within { background: #ffffff; border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12); }
body.graphite-theme .search-conv-box input { min-height: 38px; font-size: 13px; color: #1d1d1f; }
body.graphite-theme .channel-filter { gap: 6px; }
body.graphite-theme .filter-btn { font-size: 11.5px; padding: 6px 12px; color: #6e6e73; border-radius: 9999px; background: #f5f5f7; border: 1px solid transparent; font-weight: 500; transition: all 0.15s ease; }
body.graphite-theme .filter-btn:hover { background: #ebecee; color: #1d1d1f; }
body.graphite-theme .filter-btn.active { color: #ffffff; background: #1d1d1f; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); font-weight: 600; }
body.graphite-theme .filter-unread-badge { background: rgba(255, 255, 255, 0.3); color: inherit; padding: 1px 6px; border-radius: 9999px; font-size: 10px; margin-left: 4px; }
body.graphite-theme .conv-list { padding: 8px; gap: 4px; background: #ffffff; }
body.graphite-theme .conv-item { padding: 12px 14px; min-height: 82px; border: 1px solid transparent; border-radius: 12px; background: #ffffff; transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
body.graphite-theme .conv-item:hover { background: #f5f5f7; }
body.graphite-theme .conv-item.active { background: #f0f2f5; border-color: #e5e5ea; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
body.graphite-theme .conv-avatar { width: 42px; height: 42px; min-width: 42px; background: #e5e5ea !important; color: #48484a; font-size: 12px; font-weight: 600; border: 1px solid rgba(0, 0, 0, 0.04); }
body.graphite-theme .conv-item.active .conv-avatar { background: #1d1d1f !important; color: #ffffff; }
body.graphite-theme .conv-contact-name { font-size: 13.5px; color: #1d1d1f; font-weight: 600; letter-spacing: -0.01em; }
body.graphite-theme .conv-contact-label { color: #86868b; font-size: 10.5px; }
body.graphite-theme .conv-snippet-text { color: #6e6e73; line-height: 1.5; font-size: 12px; }
body.graphite-theme .conv-time { color: #86868b; font-size: 11px; }
body.graphite-theme .conv-section-header { background: transparent; padding: 10px 12px 6px; letter-spacing: .08em; color: #86868b; font-weight: 600; font-size: 10px; text-transform: uppercase; }
body.graphite-theme .conv-item .btn-del-item { background: #ffffff; bottom: 8px; border: 1px solid #e5e5ea; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }

body.graphite-theme .chat-viewport { background: #fbfbfd !important; }
body.graphite-theme .chat-view-header {
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 16px 28px 14px; border-bottom: 1px solid #e5e5ea;
  gap: 14px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02); z-index: 1;
}
body.graphite-theme .chat-contact-meta { flex: 1 1 230px; min-width: 0; }
body.graphite-theme .chat-contact-info { gap: 4px; }
body.graphite-theme #chat-contact-name { max-width: 350px; font-size: 17px; letter-spacing: -.025em; font-weight: 700; color: #1d1d1f; }
body.graphite-theme .avatar-circle { width: 44px; height: 44px; min-width: 44px; background: #f2f2f7 !important; color: #1d1d1f !important; border: 1px solid #e5e5ea; }
body.graphite-theme .chat-contact-subtitle { color: #86868b; font-size: 11.5px; }
body.graphite-theme .chat-global-tools { margin-left: auto; }
body.graphite-theme .chat-controls {
  order: 3; flex: 1 0 100%; margin: 0; padding-top: 12px; border-top: 1px solid #f2f2f7; gap: 8px;
}
body.graphite-theme .user-ai-control-wrap { gap: 8px; }
body.graphite-theme .user-ai-status-pill { background: #f5f5f7; border-color: #e5e5ea; color: #1d1d1f; border-radius: 9999px; font-size: 11.5px; padding: 4px 10px; }
body.graphite-theme .status-pulse-dot { background: #34c759; box-shadow: 0 0 6px rgba(52, 199, 89, 0.5); }
body.graphite-theme .user-ai-status-pill.paused { background: #f5f5f7; color: #86868b; }
body.graphite-theme .chat-actions-btns { margin-left: auto; gap: 8px; }
body.graphite-theme .btn-solar-felix { background: #1d1d1f !important; color: #ffffff !important; border-color: #1d1d1f !important; border-radius: 9999px !important; }
body.graphite-theme .btn-solar-felix:hover { background: #3a3a3c !important; }
body.graphite-theme .lead-tracking-banner { background: #f5f5f7 !important; border-bottom-color: #e5e5ea; padding: 12px 28px; color: #424245 !important; }
body.graphite-theme .btn-banner-action { background: #ffffff; border-color: #d1d1d6; border-radius: 9999px; }
body.graphite-theme .messages-container {
  background: #fbfbfd; background-image: none; padding: 24px clamp(16px, 3.5vw, 56px);
  gap: 12px; scroll-padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: #d1d1d6 transparent;
}
body.graphite-theme .chat-bubble { max-width: min(78%, 620px); padding: 12px 16px 10px; font-size: 14px; line-height: 1.6; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
body.graphite-theme .chat-bubble.contact { background: #ffffff; border-color: #e5e5ea; border-radius: 18px 18px 18px 4px; }
body.graphite-theme .chat-bubble.ai { background: #1d1d1f; border-color: #1d1d1f; border-radius: 18px 18px 4px 18px; color: #ffffff; }
body.graphite-theme .chat-bubble.seller { background: #e9e9eb; border-color: #dcdce0; border-radius: 18px 18px 4px 18px; color: #1d1d1f; }
body.graphite-theme .chat-bubble .bubble-text { font-size: 14px; line-height: 1.6; color: inherit; overflow-wrap: anywhere; }
body.graphite-theme .chat-bubble.ai .bubble-text { color: #f5f5f7; }
body.graphite-theme .bubble-author { font-size: 10.5px; font-weight: 600; color: #86868b !important; margin-bottom: 4px; }
body.graphite-theme .chat-bubble.ai .bubble-author { color: #a1a1a6 !important; }
body.graphite-theme .bubble-time { margin-top: 6px; font-variant-numeric: tabular-nums; gap: 5px; }
body.graphite-theme .bubble-time :is(.bubble-date-label,.bubble-date-sep,.bubble-time-label,.wa-read-text) { color: #86868b; font-size: 9.5px; }
body.graphite-theme .chat-bubble.ai .bubble-time,
body.graphite-theme .chat-bubble.ai .bubble-time :is(.bubble-date-label,.bubble-date-sep,.bubble-time-label,.wa-read-text) { color: #a1a1a6; }
body.graphite-theme .chat-bubble.ai a { color: #38bdf8; text-decoration: underline; text-underline-offset: 3px; }
body.graphite-theme .chat-bubble.ai :is(.btn-bubble-del,.btn-audio-play,.audio-play-btn) { color: #ffffff !important; background: rgba(255, 255, 255, 0.15); }
body.graphite-theme .chat-bubble.ai :is(.audio-player,.document-card,.file-card) { background: rgba(255, 255, 255, 0.08); color: #f5f5f7; }
body.graphite-theme .wa-date-divider { margin: 8px 0 12px; }
body.graphite-theme .wa-date-badge { color: #86868b; background: #ffffff; border: 1px solid #e5e5ea; border-radius: 20px; padding: 5px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); font-size: 10.5px; font-weight: 500; }
body.graphite-theme .unread-messages-divider span { background: #f5f5f7; color: #1d1d1f; border-color: #e5e5ea; font-size: 10.5px; }

body.graphite-theme .chat-composer { background: #ffffff; border-top: 1px solid #e5e5ea; padding: 14px 28px 18px; gap: 8px; flex-wrap: wrap; }
.workspace-composer-field { display: flex; align-items: flex-end; gap: 10px; width: 100%; padding: 6px 8px; background: #f5f5f7; border: 1px solid #e5e5ea; border-radius: 18px; box-shadow: none; transition: all 0.15s ease; }
.workspace-composer-field:focus-within { background: #ffffff; border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12); }
body.graphite-theme #manual-message-input {
  background: transparent; border: 0; border-radius: 10px; padding: 8px 10px;
  min-height: 38px; max-height: 140px; resize: vertical; flex: 1; min-width: 0; font: inherit; font-size: 13.5px; line-height: 1.5; box-shadow: none; color: #1d1d1f;
}
body.graphite-theme #manual-message-input:focus { outline: 0; }
body.graphite-theme .workspace-composer-field .btn-primary { min-height: 38px; padding: 8px 18px; border-radius: 9999px; flex-shrink: 0; background: #1d1d1f !important; font-weight: 600; }
.workspace-composer-note { display: flex; justify-content: space-between; gap: 12px; width: 100%; font-size: 10.5px; color: #86868b; padding: 2px 5px 0; }
.workspace-composer-note kbd { font: inherit; }
body.graphite-theme .empty-state { gap: 14px; padding: 40px 24px; }
body.graphite-theme .empty-state::before { font-size: 26px; letter-spacing: -.045em; color: #414149; }
body.graphite-theme .empty-state p { max-width: 320px; line-height: 1.8; color: #74747f; }

/* Visitas styling handled cleanly in style.css (Apple / Instagram Elite design) */

/* =========================================================
   TAB ANALÍTICA Y CENTRO DE ALERTAS WHATSAPP (APPLE HIG)
   ========================================================= */
#tab-analytics {
  display: none;
  width: 100% !important;
  box-sizing: border-box !important;
}

#tab-analytics.active {
  display: block !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: calc(100vh - 54px) !important;
  max-height: calc(100vh - 54px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 24px 32px 60px 32px !important;
  background: #fbfbfd !important;
  box-sizing: border-box !important;
}

.analytics-container {
  max-width: 1240px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 22px !important;
}

/* Panel Centro de Alertas en Vivo */
.live-alerts-panel {
  background: #ffffff !important;
  border: 1px solid #e5e5ea !important;
  border-radius: 16px !important;
  padding: 20px 24px !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

.live-alerts-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.live-alerts-title-block h3 {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  margin: 0 0 4px 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.live-alerts-title-block p {
  font-size: 12.5px !important;
  color: #86868b !important;
  margin: 0 !important;
}

.alerts-filter-bar {
  display: flex !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.btn-alert-filter {
  background: #f5f5f7 !important;
  border: 1px solid transparent !important;
  border-radius: 9999px !important;
  padding: 5px 12px !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  color: #6e6e73 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.btn-alert-filter:hover {
  background: #ebecee !important;
  color: #1d1d1f !important;
}

.btn-alert-filter.active {
  background: #1d1d1f !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

.alerts-list-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  max-height: 480px !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

.alert-item-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  border: 1px solid #e5e5ea !important;
  border-left-width: 4px !important;
  transition: transform 0.14s ease, box-shadow 0.14s ease !important;
  gap: 16px !important;
}

.alert-item-card:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

.alert-item-card.sev-critica { border-left-color: #ef4444 !important; background: #fffcfc !important; }
.alert-item-card.sev-urgente { border-left-color: #f97316 !important; background: #fffdfb !important; }
.alert-item-card.sev-venta { border-left-color: #0ea5e9 !important; background: #fbfdff !important; }
.alert-item-card.sev-atencion { border-left-color: #f59e0b !important; background: #fffefb !important; }
.alert-item-card.sev-pago { border-left-color: #10b981 !important; background: #fbfdfc !important; }

.alert-item-content {
  flex: 1 !important;
  min-width: 0 !important;
}

.alert-item-meta {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 4px !important;
  flex-wrap: wrap !important;
}

.alert-badge {
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 2px 8px !important;
  border-radius: 9999px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.alert-badge.badge-critica { background: #fee2e2 !important; color: #dc2626 !important; }
.alert-badge.badge-urgente { background: #ffedd5 !important; color: #ea580c !important; }
.alert-badge.badge-venta { background: #e0f2fe !important; color: #0284c7 !important; }
.alert-badge.badge-atencion { background: #fef3c7 !important; color: #d97706 !important; }
.alert-badge.badge-pago { background: #d1fae5 !important; color: #059669 !important; }

.alert-client-name {
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
}

.alert-client-phone {
  font-size: 12px !important;
  color: #10b981 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-weight: 500 !important;
}

.alert-client-phone:hover {
  text-decoration: underline !important;
}

.alert-time {
  font-size: 11px !important;
  color: #86868b !important;
  margin-left: auto !important;
}

.alert-title-text {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1d1d1f !important;
  margin-bottom: 2px !important;
}

.alert-snippet {
  font-size: 12px !important;
  color: #6e6e73 !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.alert-item-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

.btn-alert-action {
  padding: 7px 14px !important;
  border-radius: 9999px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  border: 1px solid #d1d1d6 !important;
  background: #ffffff !important;
  color: #1d1d1f !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.btn-alert-action:hover {
  background: #f5f5f7 !important;
  border-color: #1d1d1f !important;
}

.btn-alert-action.btn-open-chat {
  background: #1d1d1f !important;
  color: #ffffff !important;
  border-color: #1d1d1f !important;
}

.btn-alert-action.btn-archive-alert {
  background: #ffffff !important;
  color: #6e6e73 !important;
  border-color: #e5e5ea !important;
}

.btn-alert-action.btn-archive-alert:hover {
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border-color: #bbf7d0 !important;
}

.btn-alert-action.btn-unarchive-alert {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
}

.btn-alert-action.btn-unarchive-alert:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
}

.alert-badge.badge-archived {
  background: #f2f2f7 !important;
  color: #6e6e73 !important;
  border: 1px solid #d1d1d6 !important;
}

.archived-history-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

.archived-day-group {
  background: #fbfbfd !important;
  border: 1px solid #e5e5ea !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.archived-day-title {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 16px !important;
  background: #f5f5f7 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  border-bottom: 1px solid #e5e5ea !important;
}

.badge-day-count {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 2px 8px !important;
  border-radius: 9999px !important;
  background: #e5e5ea !important;
  color: #48484a !important;
}

.archived-day-items {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 10px 14px !important;
}

.alert-item-card.archived-item {
  background: #ffffff !important;
  opacity: 0.95 !important;
}

.kpi-grid-5 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
}

/* ─── CENTRO FINANCIERO & FLUJO DE CAJA (INGRESOS VS EGRESOS) ─── */
.financial-master-card {
  border-radius: 18px !important;
  padding: 24px !important;
  background: #ffffff !important;
  border: 1px solid #e5e5ea !important;
}

.financial-actions-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

.financial-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 16px !important;
  margin-top: 18px !important;
}

.fin-kpi-card {
  border-radius: 14px !important;
  padding: 18px 20px !important;
  border: 1px solid #e5e5ea !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.fin-kpi-income { background: #f0fdf4 !important; border-color: #bbf7d0 !important; }
.fin-kpi-expense { background: #fef2f2 !important; border-color: #fecaca !important; }
.fin-kpi-net { background: #f0f9ff !important; border-color: #bae6fd !important; }

.fin-kpi-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #4b5563 !important;
}

.fin-kpi-val {
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
}

.fin-kpi-income .fin-kpi-val { color: #15803d !important; }
.fin-kpi-expense .fin-kpi-val { color: #b91c1c !important; }
.fin-kpi-net .fin-kpi-val { color: #0369a1 !important; }

.fin-kpi-sub {
  font-size: 12px !important;
  color: #6b7280 !important;
}

/* Desglose de Gastos */
.expense-breakdown-panel {
  margin-top: 18px !important;
  padding: 16px 20px !important;
  background: #fbfbfd !important;
  border: 1px solid #f2f2f7 !important;
  border-radius: 14px !important;
}

.expense-breakdown-title {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #1d1d1f !important;
  margin-bottom: 14px !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.fin-chip-tag {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 3px 10px !important;
  background: #ffffff !important;
  border: 1px solid #e5e5ea !important;
  border-radius: 9999px !important;
  color: #4b5563 !important;
}

.expense-bars-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 14px !important;
}

.ledger-filter-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-top: 22px !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.ledger-tabs {
  display: flex !important;
  gap: 6px !important;
  background: #f5f5f7 !important;
  padding: 3px !important;
  border-radius: 9999px !important;
}

.btn-ledger-tab {
  background: transparent !important;
  border: none !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #6e6e73 !important;
  padding: 6px 14px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.btn-ledger-tab.active {
  background: #ffffff !important;
  color: #1d1d1f !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

.financial-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 12.5px !important;
}

.financial-table th {
  padding: 10px 14px !important;
  background: #f5f5f7 !important;
  color: #6e6e73 !important;
  font-weight: 600 !important;
  text-align: left !important;
  border-bottom: 1px solid #e5e5ea !important;
  font-size: 11.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}

.financial-table td {
  padding: 12px 14px !important;
  border-bottom: 1px solid #f2f2f7 !important;
  color: #1d1d1f !important;
  vertical-align: middle !important;
}

.financial-table tr:hover td {
  background: #fafafc !important;
}

.badge-fin-type {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 9px !important;
  border-radius: 9999px !important;
}

.badge-fin-type.badge-ingreso { background: #dcfce7 !important; color: #15803d !important; }
.badge-fin-type.badge-egreso { background: #fee2e2 !important; color: #b91c1c !important; }

.fin-amount-income {
  font-weight: 700 !important;
  color: #16a34a !important;
}

.fin-amount-expense {
  font-weight: 700 !important;
  color: #dc2626 !important;
}

/* ─── SISTEMA DE BALANCE MENSUAL URSA SOLAR ─── */
.fin-period-picker {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: #f5f5f7 !important;
  padding: 4px 12px !important;
  border-radius: 10px !important;
  border: 1px solid #e5e5ea !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #1d1d1f !important;
}

.fin-select-input {
  background: #ffffff !important;
  border: 1px solid #d1d1d6 !important;
  border-radius: 8px !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #1d1d1f !important;
  cursor: pointer !important;
  outline: none !important;
}

.fin-select-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
}

.monthly-balances-container {
  margin-top: 18px !important;
  background: #ffffff !important;
  border: 1px solid #e5e5ea !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.monthly-balances-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 18px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e5e5ea !important;
  font-size: 13px !important;
}

.monthly-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}

.financial-monthly-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 12.5px !important;
}

.financial-monthly-table th {
  padding: 10px 14px !important;
  background: #f8fafc !important;
  color: #64748b !important;
  font-weight: 600 !important;
  text-align: left !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}

.financial-monthly-table td {
  padding: 12px 14px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
  vertical-align: middle !important;
}

.financial-monthly-table tr:hover td {
  background: #f8fafc !important;
}

.financial-monthly-table tr.active-month-row td {
  background: #eff6ff !important;
  font-weight: 600 !important;
}

.badge-month-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 9px !important;
  border-radius: 9999px !important;
  background: #e2e8f0 !important;
  color: #334155 !important;
}

.badge-month-pill.current-month {
  background: #dcfce7 !important;
  color: #15803d !important;
}

.btn-select-month {
  padding: 5px 12px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0284c7 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.btn-select-month:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

@media (max-width: 1100px) {
  body.graphite-theme .conv-sidebar { width: 320px !important; min-width: 280px !important; }
  body.graphite-theme .chat-view-header { padding: 16px 18px 12px; }
  body.graphite-theme .chat-global-tools { gap: 5px !important; }
  body.graphite-theme .messages-container { padding: 24px; }
}
@media (max-width: 760px) {
  body.graphite-theme .conv-sidebar { width: 100% !important; min-width: 0 !important; }
  body.graphite-theme .conv-header { padding: 22px 18px 14px; }
  body.graphite-theme .chat-view-header { padding: 14px 16px 10px; gap: 10px; }
  body.graphite-theme .chat-contact-meta { flex-basis: 100%; }
  body.graphite-theme #chat-contact-name { max-width: 240px; }
  body.graphite-theme .chat-global-tools { width: 100%; margin-left: 0; }
  body.graphite-theme .chat-controls { padding-top: 10px; }
  body.graphite-theme .chat-actions-btns { margin-left: 0; }
  body.graphite-theme .messages-container { padding: 20px 14px; }
  body.graphite-theme .chat-bubble { max-width: 90%; padding: 12px 14px 9px; }
  body.graphite-theme .chat-composer { padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  body.graphite-theme .workspace-composer-field .btn-primary { padding: 10px 13px; }
  .workspace-composer-note .workspace-keyboard-hint { display: none; }
  body.graphite-theme .lead-tracking-banner { padding: 12px 16px; }
  body.graphite-theme .agenda-layout { padding: 14px; }
  body.graphite-theme .agenda-header { padding: 20px; }
  body.graphite-theme .agenda-actions-wrap { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  body.graphite-theme *, body.graphite-theme *::before, body.graphite-theme *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ─── POPUP COMPROBANTE DE DEPÓSITO & CONVERSACIÓN WHATSAPP ─── */
.ledger-doc-action-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.15s ease;
}

.ledger-doc-action-cell:hover .badge-clickable {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12) !important;
  filter: brightness(0.97);
}

.badge-clickable {
  cursor: pointer;
  user-select: none;
}

.ledger-quick-actions span {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.ledger-quick-actions span:hover {
  opacity: 0.8;
}

.btn-xs-chat-inline:hover {
  background: #d1fae5 !important;
  border-color: #059669 !important;
}

.voucher-modal-card {
  border-radius: 18px !important;
  background: #ffffff !important;
  overflow: hidden !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3) !important;
}

.voucher-modal-nav-tabs {
  display: flex;
  background: #f4f4f6;
  padding: 4px;
  border-bottom: 1px solid #e5e5ea;
  gap: 6px;
}

.btn-vtab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6e6e73;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-vtab:hover {
  color: #1d1d1f;
  background: rgba(255, 255, 255, 0.5);
}

.btn-vtab.active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.vtab-badge {
  background: #25d366;
  color: #ffffff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 700;
}

/* Certificado TEF */
.voucher-tef-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.tef-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px dashed #cbd5e1;
}

.tef-bank-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #0f172a;
}

.tef-bank-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0284c7;
  font-size: 15px;
}

.tef-cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 9999px;
}

.tef-hero-amount-section {
  text-align: center;
  padding: 20px 0 16px 0;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-radius: 12px;
  margin: 14px 0;
  border: 1px solid #f1f5f9;
}

.tef-amount-caption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 700;
}

.tef-amount-val {
  font-size: 28px;
  font-weight: 800;
  color: #15803d;
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}

.tef-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #166534;
  background: #bbf7d0;
  padding: 3px 12px;
  border-radius: 9999px;
}

.tef-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding-top: 10px;
}

.tef-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tef-meta-full {
  grid-column: 1 / -1;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tef-meta-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

.tef-meta-val {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.tef-meta-sub {
  font-size: 11px;
  color: #64748b;
}

.tef-meta-val-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tef-meta-val-copy code {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  background: #f1f5f9;
  padding: 3px 7px;
  border-radius: 6px;
}

.btn-copy-folio {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
}

.btn-copy-folio:hover {
  color: #0284c7;
}

/* Attachment preview section */
.tef-attachment-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.tef-attachment-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tef-image-preview-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.tef-voucher-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.tef-voucher-img:hover {
  transform: scale(1.02);
}

/* WhatsApp Chat Stream inside popup */
.vchat-contact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #f0f2f5;
  border-bottom: 1px solid #e5e5ea;
}

.vchat-contact-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vchat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #25d366;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.vchat-messages-stream {
  height: 380px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 16px;
  background: #efeae2;
  background-image: radial-gradient(#00000008 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vchat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  word-wrap: break-word;
}

.vchat-bubble.contact {
  align-self: flex-start;
  background: #ffffff;
  color: #111b21;
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.vchat-bubble.seller, .vchat-bubble.ai {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111b21;
  border-bottom-right-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.vchat-bubble-author {
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 3px;
  color: #15803d;
}

.vchat-bubble.contact .vchat-bubble-author {
  color: #0369a1;
}

.vchat-bubble-time {
  font-size: 10px;
  color: #667781;
  margin-top: 4px;
  text-align: right;
}

.vchat-composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f0f2f5;
  border-top: 1px solid #e5e5ea;
}

.vchat-composer-bar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid #e5e5ea;
  font-size: 13px;
  outline: none;
  background: #ffffff;
}

.vchat-composer-bar input:focus {
  border-color: #25d366;
}

.btn-vchat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #25d366;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-vchat-send:hover {
  background: #1eb956;
  transform: scale(1.05);
}

