/* ============================================================
   CRM Inmobiliaria — Estilos principales
   ============================================================ */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active:#2563eb;
  --body-bg:       #f1f5f9;
  --card-bg:       #ffffff;
  --border:        #e2e8f0;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --sidebar-w:     240px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

/* Sidebar oculto */
body.sidebar-hidden .sidebar      { transform: translateX(-100%); }
body.sidebar-hidden .main-wrapper { margin-left: 0; }

/* Botón toggle sidebar */
.sidebar-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-muted);
  padding: 4px 7px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  line-height: 1;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: #f1f5f9; color: var(--text); }

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none !important;
}

.brand-img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .8px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  font-weight: 500;
  letter-spacing: .2px;
}

.brand-tagline {
  margin-top: 10px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--sidebar-text);
  text-align: center;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 12px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #475569;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-radius: 0;
}

.sidebar a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar a.active {
  background: var(--primary);
  color: #fff;
}

.sidebar a i {
  font-size: 16px;
  width: 18px;
  flex-shrink: 0;
}

.nav-submenu a {
  padding-left: 48px;
  font-size: 12.5px;
}

.nav-submenu a i {
  font-size: 14px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

/* ── Layout principal ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 20px 0 14px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 28px;
  flex: 1;
  overflow: auto;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}

.card-body {
  padding: 20px;
}

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #f1f5f9; color: var(--text); }
.btn-secondary:hover { background: #e2e8f0; color: var(--text); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-sm        { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn-icon      { padding: 7px; border-radius: 7px; background: #f1f5f9; color: var(--text-muted); }
.btn-icon:hover { background: #e2e8f0; color: var(--text); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }

/* ── Formularios ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-required { color: var(--danger); margin-left: 2px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* ── Tabla ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table.crm-table {
  width: 100%;
  border-collapse: collapse;
}

table.crm-table th {
  padding: 11px 16px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.crm-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

table.crm-table tr:last-child td { border-bottom: none; }
table.crm-table tr:hover td { background: #fafbfc; }

/* ── Avatar ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }

/* ── Alertas ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Kanban ── */
.kanban-wrapper {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
}

.kanban-column {
  min-width: 260px;
  max-width: 280px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.kanban-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-col-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 20px;
}

.kanban-col-amount {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 14px 8px;
  font-weight: 600;
}

.kanban-cards {
  padding: 8px;
  min-height: 120px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow .2s, transform .15s;
  user-select: none;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.sortable-ghost {
  opacity: .4;
  background: #e0f2fe;
}

.kanban-card.sortable-drag {
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  transform: rotate(1.5deg);
  cursor: grabbing;
}

.kcard-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 8px;
}

.kcard-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.kcard-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.kcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.kcard-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
}

.kcard-tag.origin-wa { background: #d1fae5; color: #065f46; }
.kcard-tag.origin-ig { background: #fce7f3; color: #9d174d; }
.kcard-tag.origin-web { background: #dbeafe; color: #1d4ed8; }

.kcard-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

/* ── Pipeline del lead ── */
.pipeline-bar {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: 0 0 8px;
  gap: 0;
}

.pipeline-step {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pipeline-btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: #f1f5f9;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.pipeline-btn:first-child { border-radius: 7px 0 0 7px; }
.pipeline-btn:last-child  { border-radius: 0 7px 7px 0; }

.pipeline-btn.active {
  background: var(--primary);
  color: #fff;
}

.pipeline-btn:hover:not(.active) {
  background: #e2e8f0;
  color: var(--text);
}

.pipeline-btn-dim {
  opacity: .38;
  font-style: italic;
}

.pipeline-btn-dim:hover {
  opacity: .7;
}

.pipeline-arrow {
  color: #cbd5e1;
  font-size: 14px;
}

/* ── Tabs ── */
.tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  gap: 0;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; padding-top: 20px; }
.tab-pane.active { display: block; }

/* ── WhatsApp chat ── */
.wa-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding: 4px 0;
}

.wa-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 72%;
}

.wa-msg.out {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.wa-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}

.wa-msg.in .wa-bubble  { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 3px; color: var(--text); }
.wa-msg.out .wa-bubble { background: #dcf8c6; border-bottom-right-radius: 3px; color: #0f172a; }

.wa-msg .avatar-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.wa-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  text-align: right;
}

.wa-msg.in .wa-time { text-align: left; }

.wa-input-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.wa-input-bar textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
}

/* ── Auth pages ── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  opacity: .4;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.fw-700 { font-weight: 700; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.gap-8  { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-8  { margin-bottom: 8px; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 10px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -22px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--border);
  background: var(--primary);
}

.timeline-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.timeline-time {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.timeline-body {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
}

/* ── Selector de embudo ── */
.funnel-card {
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 14px 10px;
  text-align: center;
  color: var(--text-muted);
  transition: border-color .15s, color .15s, background .15s;
  background: #fff;
}

.funnel-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f7ff;
}

.funnel-card-active {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Overlay del sidebar en mobile ── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body.sidebar-mobile-open #sidebar-overlay { display: block; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — Tablets y celulares  (≤ 768px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar: drawer desde la izquierda ── */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  body.sidebar-mobile-open .sidebar { transform: translateX(0); }
  body.sidebar-hidden      .sidebar { transform: translateX(-100%); }
  .main-wrapper { margin-left: 0 !important; transition: none !important; }

  /* ── Topbar ── */
  .topbar { padding: 0 10px 0 8px; height: 54px; }
  .topbar-title {
    font-size: 14.5px;
    max-width: 36vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar-actions { gap: 6px; }
  .sidebar-toggle-btn { font-size: 24px; }

  /* ── Contenido ── */
  .page-content { padding: 10px !important; }

  /* ── Botones: área mínima de toque ── */
  .btn     { min-height: 40px; }
  .btn-sm  { min-height: 34px; font-size: 12.5px; }
  .btn-icon { min-height: 34px; min-width: 34px; }

  /* ── Grids 2-col → 1-col ── */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-column:span 2"],
  [style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }
  /* Grids 3-col → 2-col */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Kanban: columnas casi full-width, scroll horizontal ── */
  .kanban-column  { min-width: calc(90vw - 16px) !important; max-width: calc(90vw - 16px) !important; }
  .kanban-cards   { flex-direction: column !important; flex-wrap: nowrap !important; }
  .kanban-card    { width: 100% !important; }

  /* ── Pipeline de etapas ── */
  .pipeline-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .pipeline-bar::-webkit-scrollbar { height: 3px; background: #f1f5f9; }
  .pipeline-bar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
  .pipeline-btn { font-size: 11px; padding: 6px 10px; }

  /* ── Tabs ── */
  .tabs-nav { overflow-x: auto !important; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; padding: 10px 10px; font-size: 11.5px; white-space: nowrap; }
  .tab-drag-handle { display: none; }

  /* ── Modales → bottom sheet ── */
  #dact-modal-backdrop,
  #act-modal-backdrop {
    align-items: flex-end !important;
  }
  #dact-modal,
  #act-modal {
    width:        100vw !important;
    max-width:    100vw !important;
    max-height:   90vh !important;
    border-radius: 16px 16px 0 0 !important;
    margin:        0 !important;
  }

  /* ── crmAlert/crmConfirm ── */
  #crm-msg-backdrop > div {
    max-width: 90vw !important;
    padding:   22px 18px 16px !important;
  }

  /* ── Notif dropdown ── */
  .notif-dropdown {
    width:         calc(100vw - 16px);
    right:         -44px;
    border-radius: 12px;
  }

  /* ── Tablas → scroll horizontal ── */
  .table-wrapper { -webkit-overflow-scrolling: touch; }
  table.crm-table { min-width: 540px; }

  /* ── Cards ── */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-body   { padding: 14px; }

  /* ── Formularios: search bar en contactos ── */
  .card-header form[method="GET"] { width: 100%; flex-wrap: wrap; }
  .card-header form[method="GET"] .form-control { width: 100% !important; flex: 1; min-width: 0; }

  /* ── Embudo cards en create lead ── */
  .funnel-card { padding: 10px 6px; }

  /* ── Botón de actividad (kc-act-btn) siempre visible en mobile ── */
  .kc-act-btn { opacity: .7 !important; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — Celulares  (≤ 480px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .page-content  { padding: 8px !important; }
  .topbar-title  { max-width: 26vw; font-size: 13.5px; }
  .topbar-actions { gap: 4px; }

  /* Grids 2-col → 1-col (refuerzo) */
  [style*="grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:auto-fill"] { grid-template-columns: 1fr !important; }
  /* Properties card grid */
  [style*="repeat(auto-fill,minmax(240px"] { grid-template-columns: 1fr !important; }

  /* Kanban full-width */
  .kanban-column { min-width: calc(96vw - 16px) !important; max-width: calc(96vw - 16px) !important; }

  /* Notif dropdown */
  .notif-dropdown { right: -54px; }

  /* Tabs más compactos */
  .tab-btn { padding: 10px 8px; font-size: 10.5px; }

  /* Activity type buttons → scroll */
  .act-type-row, #dact-type-row { overflow-x: auto; padding-bottom: 2px; }
  .act-type-btn, .dact-type-btn { flex-shrink: 0; min-width: 54px; }

  /* Pri buttons */
  .act-pri-btn, .dact-pri-btn { font-size: 10.5px !important; }

  /* Modal footer en columna */
  .act-modal-footer, #dact-modal > div:last-child {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .act-modal-footer .act-footer-right { flex-wrap: wrap; margin-left: 0 !important; }
}

/* ============================================================
   Notificaciones — Campanita
   ============================================================ */

/* ── Bell button ── */
.notif-bell-wrap { position:relative; }

.notif-bell-btn {
  position:relative; cursor:pointer;
  width:38px; height:38px; border-radius:10px;
  background:#fff; border:1.5px solid #e2e8f0;
  box-shadow:0 1px 3px rgba(0,0,0,.07);
  color:#64748b; font-size:17px;
  display:flex; align-items:center; justify-content:center;
  transition:all .18s;
}
.notif-bell-btn:hover {
  border-color:#cbd5e1; color:#1e293b;
  box-shadow:0 3px 10px rgba(0,0,0,.11);
  transform:translateY(-1px);
}
.notif-bell-btn.has-notif {
  border-color:#fed7aa; background:#fff7ed; color:#ea580c;
  box-shadow:0 2px 10px rgba(234,88,12,.18);
}

@keyframes bell-ring {
  0%,60%,100% { transform:rotate(0) translateY(-1px); }
  65%  { transform:rotate(-14deg) translateY(-1px); }
  75%  { transform:rotate(12deg)  translateY(-1px); }
  85%  { transform:rotate(-8deg)  translateY(-1px); }
  92%  { transform:rotate(5deg)   translateY(-1px); }
}
.notif-bell-btn.has-notif { animation:bell-ring 2.4s ease-in-out infinite; }

/* ── Badge ── */
@keyframes badge-pop {
  0%   { transform:scale(0); }
  70%  { transform:scale(1.2); }
  100% { transform:scale(1); }
}
.notif-badge {
  position:absolute; top:-7px; right:-7px;
  min-width:19px; height:19px;
  background:#ef4444; color:#fff;
  font-size:9px; font-weight:800; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  padding:0 4px; pointer-events:none;
  border:2.5px solid var(--card-bg);
  box-shadow:0 2px 6px rgba(239,68,68,.5);
  animation:badge-pop .25s cubic-bezier(.34,1.56,.64,1) both;
}

/* ── Dropdown ── */
@keyframes notif-drop-in {
  from { opacity:0; transform:translateY(-10px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.notif-dropdown {
  position:absolute; right:0; top:calc(100% + 10px);
  width:360px; background:#fff; border-radius:16px;
  box-shadow:0 24px 64px rgba(0,0,0,.16), 0 4px 16px rgba(0,0,0,.07);
  z-index:9990; overflow:hidden;
  animation:notif-drop-in .2s cubic-bezier(.16,1,.3,1) both;
}

/* ── Header del dropdown ── */
.notif-drop-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:15px 18px 13px;
  background:linear-gradient(135deg,#0f172a 0%,#1e3a5f 100%);
}
.notif-drop-htitle {
  display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:700; color:#fff;
}
.notif-drop-htitle i { color:#fb923c; font-size:15px; }
.notif-mark-all {
  font-size:11px; font-weight:600; color:#94a3b8;
  background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.15);
  border-radius:20px; padding:3px 10px; cursor:pointer;
  transition:all .15s;
}
.notif-mark-all:hover { background:rgba(255,255,255,.2); color:#fff; }

/* ── Lista ── */
.notif-drop-list { max-height:320px; overflow-y:auto; }
.notif-drop-list::-webkit-scrollbar { width:4px; }
.notif-drop-list::-webkit-scrollbar-track { background:transparent; }
.notif-drop-list::-webkit-scrollbar-thumb { background:#e2e8f0; border-radius:4px; }

/* ── Item ── */
.notif-drop-item {
  display:flex; align-items:flex-start; gap:12px;
  padding:12px 16px; border-bottom:1px solid #f1f5f9;
  cursor:pointer; transition:background .12s;
  border-left:3px solid transparent; position:relative;
}
.notif-drop-item:last-child { border-bottom:none; }
.notif-drop-item:hover { background:#f8fafc; }
.notif-item-unread {
  background:#f8faff;
  border-left-color:var(--ni-color,#3b82f6);
}
.notif-item-unread:hover { background:#f0f4ff; }

/* Ícono circular con color de tipo */
.notif-item-ico {
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:15px;
  background:var(--ni-bg,#eff6ff);
  color:var(--ni-color,#3b82f6);
}

.notif-item-body { flex:1; min-width:0; }
.notif-item-title {
  font-size:12px; font-weight:700; color:#0f172a;
  display:flex; align-items:center; gap:6px;
}
.notif-item-title .ni-dot {
  width:6px; height:6px; border-radius:50%; flex-shrink:0;
  background:var(--ni-color,#3b82f6);
}
.notif-item-msg {
  font-size:11.5px; color:#64748b; margin-top:3px; line-height:1.45;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.notif-item-time { font-size:10.5px; color:#94a3b8; margin-top:5px; }

/* ── Empty state ── */
.notif-drop-empty {
  padding:36px 20px; text-align:center; color:#94a3b8;
}
.notif-drop-empty i { font-size:32px; display:block; margin-bottom:10px; opacity:.4; }
.notif-drop-empty span { font-size:13px; font-weight:500; }

/* ── Footer ── */
.notif-drop-footer {
  padding:11px 18px; border-top:1px solid #f1f5f9;
  display:flex; align-items:center; justify-content:center;
  background:#fafbfc;
}
.notif-drop-footer a {
  font-size:12px; font-weight:600; color:#6366f1;
  text-decoration:none; display:flex; align-items:center; gap:5px;
  transition:color .15s;
}
.notif-drop-footer a:hover { color:#4f46e5; }
.notif-drop-footer a i { font-size:11px; }
