:root {
  --bg: #f5f6fa;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-soft: rgba(37, 99, 235, 0.13);
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --shadow: 0 24px 56px rgba(88, 84, 145, 0.12);
}

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

/* Ocultar scrollbar en todos los navegadores pero mantener scroll */
::-webkit-scrollbar {
  display: none;
}

* {
  -ms-overflow-style: none;
  /* IE y Edge */
  scrollbar-width: none;
  /* Firefox */
}


body {
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background:
    radial-gradient(90rem 60rem at -8% 105%, rgba(80, 70, 230, 0.35), transparent 58%),
    radial-gradient(80rem 56rem at 112% -4%, rgba(59, 130, 246, 0.29), transparent 55%),
    linear-gradient(145deg, #e8e6fb 0%, #f8f8ff 42%, #f3f5fb 100%);
  min-height: 100vh;
  overflow: hidden;
}

h2,
h3,
h4 {
  font-family: 'Sora', sans-serif;
}

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

.glass-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.app-layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

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

.brand-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.brand-logo {
  width: 108px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border: none;
  border-radius: 0;
}

.sidebar-nav {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.nav-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  margin: 6px 0 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #374151;
  transition: 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--border);
}

.nav-item.active {
  color: #1d4ed8;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.16), rgba(255, 255, 255, 0.65));
  border-color: rgba(37, 99, 235, 0.18);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  background: rgba(255, 255, 255, 0.45);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.dot.red {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.45);
}

.dot.green {
  background: var(--success);
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.45);
}

.motor-group {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.motor-toggle {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: inherit;
  cursor: pointer;
}

.main-content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumb {
  display: block;
  color: var(--muted);
  font-size: 0.77rem;
  margin-bottom: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-pill {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #4f46e5, #2563eb);
}

.views-container {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 2px;
  padding-bottom: 18px;
}

.view {
  display: none;
  animation: fadeIn 0.23s ease;
  padding-bottom: 14px;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px;
  margin-bottom: 12px;
}

.kicker {
  color: var(--accent);
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.hero-panel h3 {
  margin-top: 4px;
  font-size: 1.45rem;
}

.hero-number {
  font-size: 2.2rem;
  line-height: 1;
  margin-top: 8px;
  font-weight: 800;
  background: linear-gradient(90deg, #7c3aed 0%, #2563eb 45%, #0ea5e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin-top: 7px;
  color: var(--muted);
}

.hero-actions {
  display: grid;
  gap: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 4px;
}

.metric-card strong {
  font-size: 1.24rem;
}

.metric-card.soft {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-card {
  padding: 12px;
}

.chart-card.inner {
  margin: 12px 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-head h4 {
  font-size: 0.94rem;
}

canvas {
  width: 100% !important;
  height: 250px !important;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
}

.table-panel {
  padding: 12px;
  overflow: visible;
}

.table-panel.compact {
  min-height: 260px;
}

.compact-table {
  min-width: 100%;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-actions input,
.panel-actions select {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 9px;
  padding: 7px 9px;
  font: inherit;
}

.lead-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.lead-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
  font-size: 0.8rem;
}

.lead-chip strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

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

.data-table th {
  font-size: 0.73rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  font-size: 0.88rem;
}

.badge,
.pill {
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 9px;
}

.badge.on,
.pill.respondido,
.pill.active {
  background: rgba(22, 163, 74, 0.14);
  color: var(--success);
}

.badge.off,
.pill.nuevo,
.pill.alert {
  background: rgba(220, 38, 38, 0.14);
  color: var(--danger);
}

.badge.warning,
.pill.contactado,
.pill.warn {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warning);
}

.pill.blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.mini-stats {
  list-style: none;
  display: grid;
  gap: 8px;
}

.mini-stats li {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.87rem;
}

.progress-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

.row-actions {
  display: grid;
  gap: 6px;
}

.row-actions button {
  width: 100%;
  justify-content: center;
  font-size: 0.75rem;
  padding: 6px 8px;
}

.balance-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
}

.notifications-panel {
  padding: 12px;
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.notifications-list {
  overflow: auto;
  display: grid;
  gap: 8px;
}

.notifications-empty {
  color: var(--muted);
  text-align: center;
  margin-top: 28px;
}

.notification-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  cursor: pointer;
}

.notification-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
}

.notification-icon.is-whatsapp {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.notification-icon.is-log {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.notification-icon.is-mail {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.notification-content h4 {
  font-size: 0.9rem;
}

.notification-content p {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.notification-content small {
  color: var(--muted);
  font-size: 0.7rem;
}

.btn-primary,
.btn-secondary,
.btn-outline-danger,
.icon-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 8px 11px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

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

.btn-outline-danger {
  background: #fff;
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}

.icon-btn {
  width: 32px;
  height: 32px;
  justify-content: center;
  background: #fff;
  border-color: var(--border);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.43);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 12px;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(640px, 100%);
  padding: 14px;
}

.modal-card.small {
  width: min(460px, 100%);
}

.form-grid {
  display: grid;
  gap: 8px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}

.form-grid textarea {
  min-height: 76px;
  resize: vertical;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.split-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

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

.modal-actions.between {
  justify-content: space-between;
}

.inline-actions {
  display: flex;
  gap: 8px;
}

.toast-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 80;
  display: grid;
  gap: 8px;
}

.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 220px;
  box-shadow: var(--shadow);
  font-size: 0.87rem;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.info {
  border-left-color: var(--accent);
}

.toast.is-whatsapp {
  border-left-color: #25d366;
}

.toast.is-mail {
  border-left-color: #3b82f6;
}

.mobile-only {
  display: none;
}

@media (max-width: 1300px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .charts-grid,
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }

  .balance-summary-grid,
  .lead-counters {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-layout {
    display: block;
    height: auto;
  }

  .sidebar {
    position: fixed;
    inset: 10px auto 10px 10px;
    width: min(300px, 92vw);
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    z-index: 70;
  }

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

  .main-content {
    min-height: 100vh;
  }

  .mobile-only {
    display: inline-flex;
  }

  .top-actions .profile-pill {
    display: none;
  }

  .top-actions button span {
    display: none;
  }

  .split-2,
  .split-3 {
    grid-template-columns: 1fr;
  }
}