@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #f7f8fa;
  --bg-subtle: #eef0f3;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #4b5563;
  --muted: #6b7280;
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-soft: #e8f5f3;
  --sidebar: #000000;
  --sidebar-hover: #1a1a1a;
  --sidebar-active: #262626;
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-text-active: #ffffff;
  --accent: #f59e0b;
  --border: #e8eaed;
  --border-strong: #d1d5db;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning-soft: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.07);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --transition: 0.2s ease;
  --content-max: 1400px;
}

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

html {
  color-scheme: light;
  background-color: #f7f8fa;
}

body {
  margin: 0;
  font-family: var(--font);
  background-color: #f7f8fa;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { color: var(--primary-hover); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: var(--sidebar-text-active);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
  border-right: 1px solid #1f1f1f;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand .logo {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.sidebar-brand .name {
  font-weight: 700;
  font-size: 1.08rem;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.sidebar-brand .tagline {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
}

.sidebar nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  overflow-y: auto;
}

.sidebar nav .nav-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0.65rem 0.85rem 0.3rem;
  margin-top: 0.35rem;
  font-weight: 600;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--sidebar-text);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar nav a .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  text-decoration: none;
}

.sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 #fff;
}

.sidebar nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 1rem 1.15rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.user-card .info { flex: 1; min-width: 0; }
.user-card .name { font-size: 0.82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .email { font-size: 0.68rem; color: rgba(255, 255, 255, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer .logout-link {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
}

.sidebar-footer .logout-link:hover { color: #fff; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 150;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.visible { display: block; opacity: 1; }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: #f7f8fa;
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius-sm);
}

.menu-toggle:hover { background: var(--bg-subtle); }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.topbar-breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: auto;
}

.topbar-breadcrumb a { color: var(--muted); font-weight: 500; }
.topbar-breadcrumb a:hover { color: var(--primary); }

.topbar-search {
  flex: 1;
  max-width: 320px;
  margin: 0 0.5rem;
}

.topbar-search input {
  width: 100%;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.topbar-search input:focus {
  background: var(--surface);
  border-color: var(--border-strong);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

.checkbox-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  cursor: pointer;
}

.checkbox-hint input { width: auto; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-icon { font-size: 1.1rem; flex-shrink: 0; }

.timeline-text { margin: 0; font-size: 0.9rem; }

.timeline-meta { font-size: 0.75rem; color: var(--muted); }

.stale-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stale-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.preview-panel {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-panel h3 { margin: 0 0 0.75rem; font-size: 0.9rem; }

.preview-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
  margin: 0;
  background: var(--surface);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.content {
  padding: 1.75rem 2rem 3rem;
  flex: 1;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  background: var(--bg);
}

.app-body {
  background: var(--bg);
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-main {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: 0.1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}

.back-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.page-header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header .subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card-flush {
  background: var(--surface);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.card-body { padding: 1.25rem; }

.card-flush .table-wrap { margin: 0; border-radius: 0; border: none; box-shadow: none; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-card.highlight {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(13, 148, 136, 0.12);
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 0.65rem;
}

.stat-card .stat-icon.teal { background: var(--primary-soft); }
.stat-card .stat-icon.amber { background: var(--warning-soft); }
.stat-card .stat-icon.green { background: var(--success-soft); }

.stat-card .num {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.stat-card .lbl {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.stat-card a.stat-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.stat-card a.stat-link:hover .num { color: var(--primary); }

/* Pipeline mini bar */
.pipeline-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
  margin: 1rem 0 0.5rem;
}

.pipeline-bar span { transition: width 0.3s ease; }
.pipeline-bar .p-nuevo { background: #3b82f6; }
.pipeline-bar .p-contactado { background: #6366f1; }
.pipeline-bar .p-calificado { background: #06b6d4; }
.pipeline-bar .p-propuesta { background: #f59e0b; }
.pipeline-bar .p-negociacion { background: #f97316; }
.pipeline-bar .p-ganado { background: #10b981; }
.pipeline-bar .p-perdido { background: #94a3b8; }

.pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.pipeline-legend span::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), transform 0.1s ease, box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
  text-decoration: none;
}

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

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

.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; text-decoration: none; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-icon {
  padding: 0.45rem;
  min-width: 36px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

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

table.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tbody tr {
  transition: background var(--transition);
}

table.data-table tbody tr:hover { background: var(--bg-subtle); }

table.data-table tbody tr:last-child td { border-bottom: none; }

.table-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

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

.row-link { color: inherit; font-weight: 600; }
.row-link:hover { color: var(--primary); text-decoration: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-nuevo { background: #dbeafe; color: #1d4ed8; }
.badge-contactado { background: #e0e7ff; color: #4338ca; }
.badge-calificado { background: #cffafe; color: #0e7490; }
.badge-propuesta { background: #fef3c7; color: #b45309; }
.badge-negociacion { background: #ffedd5; color: #c2410c; }
.badge-ganado { background: #d1fae5; color: #047857; }
.badge-perdido { background: #f5f5f5; color: #525252; }
.badge-default { background: #f5f5f5; color: #737373; }

.badge-channel {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  text-transform: capitalize;
}

.badge-channel.email { background: #eff6ff; color: #1d4ed8; }
.badge-channel.whatsapp { background: #ecfdf5; color: #047857; }

.badge-status-sent { background: var(--success-soft); color: var(--success); }
.badge-status-failed { background: var(--danger-soft); color: var(--danger); }
.badge-status-link { background: #ecfdf5; color: #047857; }
.badge-status-pending { background: var(--warning-soft); color: #b45309; }

/* Forms */
.form-card { max-width: 640px; }

.form-group { margin-bottom: 1.15rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.form-actions-spread {
  justify-content: space-between;
  width: 100%;
}

/* Toolbar / filters */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-field {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-field input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.35rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
}

.search-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.search-field::before {
  content: '⌕';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

.toolbar select {
  padding: 0.55rem 2rem 0.55rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  min-width: 160px;
}

/* Alerts */
.alerts { margin-bottom: 1rem; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
}

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

.alert.alert-hide {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s, transform 0.3s;
}

.alert-success {
  background: var(--success-soft);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.alert-body { flex: 1; }
.alert-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
  color: inherit;
}

.alert-dismiss:hover { opacity: 1; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 1.1rem;
}

.empty-state p { margin: 0 0 1rem; font-size: 0.9rem; }

/* Detail layout */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.info-list {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}

.info-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.info-item dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.info-item dd { margin: 0; font-weight: 500; }

/* Status pipeline (lead detail) */
.status-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.status-step {
  flex: 1;
  min-width: 70px;
  text-align: center;
  padding: 0.5rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-subtle);
  border-radius: 6px;
  position: relative;
}

.status-step.done {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.status-step.current {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
}

.status-change-box {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}

.status-change-box h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-change-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.status-change-form select {
  flex: 1;
  min-width: 180px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
}

.notes-block {
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid transparent;
}

.pagination a:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--primary);
  text-decoration: none;
}

.pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination .muted {
  color: var(--muted);
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

/* Chips filter (leads) */
.chip-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chip .count {
  margin-left: 0.35rem;
  opacity: 0.8;
  font-size: 0.75rem;
}

/* Placeholder tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--bg);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr);
  width: 100%;
  max-width: none;
  min-height: 100vh;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: #000;
  color: #fff;
}

.login-brand .logo-big {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
}

.login-brand p {
  margin: 0.75rem 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 280px;
}

.login-box-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--surface);
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 0.5rem;
}

.login-box h2,
.login-heading {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.login-box .form-group input { max-width: none; }

.login-box .btn-primary {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .login-panel {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .login-brand {
    padding: 2rem 1.5rem;
    text-align: center;
    align-items: center;
  }
  .login-brand p { max-width: none; }
}

.meta { color: var(--muted); font-size: 0.85rem; }
.inline-form { display: inline; }

.danger-zone {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.danger-zone p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* Quick links dashboard */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quick-link-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.quick-link-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.quick-link-card .ql-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 10px;
  font-size: 1.1rem;
}

.quick-link-card .ql-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.quick-link-card .ql-text strong {
  font-size: 0.9rem;
  color: var(--text);
}

.quick-link-card .ql-text small {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .app-main { margin-left: 0; }

  .menu-toggle { display: flex; }

  .content { padding: 1rem; }

  .info-item { grid-template-columns: 1fr; gap: 0.15rem; }

  table.data-table th:nth-child(n+4),
  table.data-table td:nth-child(n+4) {
    /* keep essential cols on mobile - optional hide */
  }
}

body.nav-open { overflow: hidden; }

/* Focus accesible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-search {
  position: relative;
}

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

.topbar-search input {
  padding-left: 2.5rem;
}

/* Tabs */
.tabs {
  margin-bottom: 1.25rem;
}

.tabs-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs-nav button {
  flex: 1;
  min-width: max-content;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.tabs-nav button:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.tabs-nav button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Panel cards (lead detail) */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.15rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.panel-card-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.panel-card-body {
  padding: 1.15rem;
}

/* Pipeline scroll móvil */
.status-pipeline {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
}

.status-step {
  flex: 0 0 auto;
  min-width: 88px;
}

/* Copy link */
.copy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
}

.copy-link .copy-btn {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.copy-link .copy-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.copy-toast {
  position: absolute;
  top: -1.5rem;
  right: 0;
  font-size: 0.7rem;
  background: var(--text);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Form sections */
.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* Submit loading */
.btn.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

/* FAB móvil */
.fab-menu {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 180;
}

.fab-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.45);
  transition: transform 0.2s ease;
}

.fab-menu.open .fab-toggle {
  transform: rotate(45deg);
}

.fab-icon-close { display: none; }
.fab-menu.open .fab-icon-open { display: none; }
.fab-menu.open .fab-icon-close { display: inline; }

.fab-actions {
  position: absolute;
  bottom: 64px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 160px;
}

.fab-action {
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  text-align: right;
}

.fab-action:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* Keyboard hint */
.keyboard-hint {
  position: fixed;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  z-index: 10;
  display: none;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  font-family: inherit;
  font-size: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border-strong);
}

@media (min-width: 901px) {
  .keyboard-hint { display: block; }
}

/* Tablas responsive → tarjetas en móvil */
@media (max-width: 768px) {
  .fab-menu { display: block; }

  .topbar-breadcrumb { display: none; }

  .topbar-title {
    font-size: 0.9rem;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table-responsive .data-table thead {
    display: none;
  }

  .table-responsive .data-table tbody tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .table-responsive .data-table tbody tr:hover {
    background: var(--bg-subtle);
  }

  .table-responsive .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.35rem 0;
    border: none;
    text-align: right;
  }

  .table-responsive .data-table td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }

  .table-responsive .data-table td.table-actions {
    justify-content: flex-end;
    padding-top: 0.5rem;
  }

  .table-responsive .data-table td.table-actions::before {
    display: none;
  }

  .page-header h1 { font-size: 1.35rem; }

  .detail-grid { gap: 1rem; }

  .chip-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .chip { flex-shrink: 0; }
}

/* Lead hero summary */
.lead-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.lead-hero .lead-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-hover);
}

.lead-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lead-hero-meta a { font-weight: 600; }

/* Collapse */
.collapse-panel {
  display: none;
}

.collapse-panel.open {
  display: block;
}

.btn-collapse {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
}

.btn-collapse:hover { text-decoration: underline; }

/* Stale list polish */
.stale-list li a {
  font-weight: 600;
  color: var(--text);
}

.stale-list li a:hover {
  color: var(--primary);
}

/* Content max width center on very wide */
@media (min-width: 1400px) {
  .content {
    max-width: var(--content-max);
    margin: 0 auto;
    width: 100%;
  }
}

/* Nav badge */
.sidebar nav .nav-badge {
  margin-left: auto;
  background: #fff;
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.nav-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.sidebar nav a {
  position: relative;
}

/* Task list */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list.compact .task-item {
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.task-item:last-child { border-bottom: none; }

.task-item-body { flex: 1; min-width: 0; }

.task-item-body strong { display: block; }

.task-due {
  font-size: 0.75rem;
  color: var(--muted);
}

.task-overdue { background: #fef2f2; margin: 0 -0.5rem; padding-left: 0.5rem !important; padding-right: 0.5rem !important; border-radius: 6px; }
.task-overdue .task-due { color: var(--danger); font-weight: 600; }
.task-today .task-due { color: #b45309; font-weight: 600; }
.task-done { opacity: 0.6; }

.task-list.compact .task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.task-list.compact .task-item-body {
  flex: 1;
  min-width: 0;
}

.task-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Kanban */
.kanban-toolbar { margin-bottom: 1rem; padding: 0.85rem 1rem !important; }
.kanban-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.kanban-toolbar-row select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--surface);
}
.kanban-search { flex: 1; min-width: 180px; max-width: 280px; }
.kanban-toolbar-check { margin: 0; white-space: nowrap; font-size: 0.8rem; }
.kanban-toolbar-options { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }

.kanban-board-wrap { position: relative; }
.kanban-board-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: var(--bg);
  padding: 1rem 1.25rem 1.5rem;
  overflow: auto;
}
body.kanban-fullscreen-active { overflow: hidden; }
.kanban-board-wrap.is-fullscreen .kanban-board {
  min-height: calc(100vh - 160px);
}
.kanban-board-wrap.is-fullscreen .kanban-column {
  max-height: calc(100vh - 180px);
}

.kanban-board {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 1.25rem;
  min-height: calc(100vh - 280px);
  align-items: flex-start;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.kanban-column {
  flex: 0 0 300px;
  max-width: 300px;
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  scroll-snap-align: start;
  border: 1px solid var(--border);
  transition: opacity 0.2s, transform 0.2s;
}

.kanban-column.is-hidden { display: none; }

.kanban-column.is-collapsed {
  flex: 0 0 56px;
  max-width: 56px;
  min-width: 56px;
}
.kanban-column.is-collapsed .kanban-cards { display: none; }
.kanban-column.is-collapsed .kanban-column-value { display: none; }
.kanban-column.is-collapsed .kanban-column-title { flex-direction: column; align-items: center; }
.kanban-column.is-collapsed .kanban-column-header .badge { font-size: 0.55rem; padding: 0.15rem 0.3rem; writing-mode: vertical-rl; transform: rotate(180deg); }
.kanban-column.is-collapsed .kanban-collapse-icon { transform: rotate(-90deg); }

.kanban-column-header {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 3px solid var(--border-strong);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  display: block;
  position: relative;
  transition: background 0.15s;
}
.kanban-column-header:hover { background: var(--bg-subtle); }

.kanban-collapse-icon {
  position: absolute;
  right: 0.5rem;
  top: 0.65rem;
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.kanban-col-nuevo .kanban-column-header { border-top-color: #3b82f6; }
.kanban-col-contactado .kanban-column-header { border-top-color: #6366f1; }
.kanban-col-calificado .kanban-column-header { border-top-color: #06b6d4; }
.kanban-col-propuesta .kanban-column-header { border-top-color: #f59e0b; }
.kanban-col-negociacion .kanban-column-header { border-top-color: #f97316; }
.kanban-col-ganado .kanban-column-header { border-top-color: #10b981; }
.kanban-col-perdido .kanban-column-header { border-top-color: #94a3b8; }

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.kanban-count {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
  background: var(--bg-subtle);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.kanban-column-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 120px;
}

.kanban-cards.drag-over {
  background: var(--primary-soft);
  border-radius: 0 0 var(--radius) var(--radius);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}

.kanban-card {
  position: relative;
  display: flex;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
  border-left: 3px solid var(--border-strong);
  cursor: pointer;
}

.kanban-card.priority-alta { border-left-color: #dc2626; }
.kanban-card.priority-media { border-left-color: #f59e0b; }
.kanban-card.priority-baja { border-left-color: #0ea5e9; }

.kanban-card:hover { box-shadow: var(--shadow-lg); }

.kanban-card.dragging {
  opacity: 0.45;
  transform: rotate(2deg);
  box-shadow: var(--shadow-lg);
}

.kanban-card.is-saving {
  opacity: 0.7;
  pointer-events: none;
}

.kanban-card.is-filtered-out { display: none !important; }

.kanban-card.is-active {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.kanban-card.is-success {
  animation: kanbanPulse 0.5s ease;
}

@keyframes kanbanPulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 3px var(--primary-soft); }
}

.kanban-card-open {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--bg-subtle);
  border-radius: 4px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}
.kanban-card-open:hover { background: var(--border); color: var(--text); }

.kanban-board.kanban-compact .kanban-card { padding: 0; }
.kanban-board.kanban-compact .kanban-card-tags,
.kanban-board.kanban-compact .kanban-card-meta { display: none; }
.kanban-board.kanban-compact .kanban-card-body { padding: 0.5rem 1.75rem 0.5rem 0; }
.kanban-board.kanban-compact .kanban-card-footer { margin-top: 0.2rem; }

.kanban-drag-handle {
  flex-shrink: 0;
  width: 22px;
  padding: 0.65rem 0 0.65rem 0.35rem;
  color: var(--muted);
  cursor: grab;
  font-size: 0.85rem;
  line-height: 1;
  user-select: none;
}

.kanban-card.dragging .kanban-drag-handle { cursor: grabbing; }

.kanban-card-body { flex: 1; min-width: 0; padding: 0.65rem 0.65rem 0.65rem 0; }

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.kanban-card-top .badge { flex-shrink: 0; font-size: 0.62rem; }

.kanban-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  display: block;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.kanban-card-title:hover { color: var(--primary); text-decoration: none; }

.kanban-card-meta {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-tags { margin-bottom: 0.35rem; }
.kanban-card-tags .tag-badge { font-size: 0.6rem; padding: 0.1rem 0.35rem; }

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.kanban-card-value { font-size: 0.85rem; color: var(--primary-hover); }

.kanban-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
  align-items: center;
}

.kanban-pill {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
}

.kanban-pill-close { background: #dbeafe; color: #1d4ed8; }
.kanban-pill-stale { background: #fef3c7; color: #b45309; }

.kanban-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.55rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kanban-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 300;
  animation: fadeIn 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.kanban-toast.is-error { background: var(--danger); }

.kanban-no-results {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: 0.95rem;
}

/* Panel lateral Kanban */
.kanban-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 260;
}

.kanban-panel-overlay[hidden] {
  display: none !important;
}

.kanban-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 270;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
}

.kanban-panel[hidden] {
  display: none !important;
}

.kanban-panel:not([hidden]) {
  display: flex;
  animation: kanbanSlideIn 0.25s ease;
}
@keyframes kanbanSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.kanban-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.kanban-panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
  flex: 1;
}
.kanban-panel-close {
  border: none;
  background: var(--bg-subtle);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}
.kanban-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
}
.kanban-panel-section { margin-bottom: 1.15rem; }
.kanban-panel-section .panel-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.kanban-panel-info { margin: 0; }
.kanban-panel-notes {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}
.kanban-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.kanban-status-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.kanban-status-btn:hover { border-color: var(--primary); color: var(--primary); }
.kanban-status-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.kanban-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
body.kanban-panel-open { overflow: hidden; }

/* Prioridad */
.badge-priority-alta { background: #fee2e2; color: #b91c1c; }
.badge-priority-media { background: #fef3c7; color: #b45309; }
.badge-priority-baja { background: #e0f2fe; color: #0369a1; }

/* Etiquetas */
.tag-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--tag-color, #0d9488) 18%, transparent);
  color: var(--tag-color, #0d9488);
  margin: 0.15rem 0.25rem 0.15rem 0;
}
.tags-select { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-checkbox { cursor: pointer; }
.tag-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-checkbox input:checked + .tag-chip { outline: 2px solid var(--tag-color); outline-offset: 2px; }
.tag-chip {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--tag-color) 15%, var(--surface));
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 35%, transparent);
}
.tags-admin-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-admin-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem 0.25rem 0.5rem;
  background: var(--bg-subtle);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tag-admin-item .btn-ghost { padding: 0.15rem 0.4rem; min-width: auto; color: var(--muted); }
.tag-admin-item .btn-ghost:hover { color: var(--danger); }

.kanban-empty-hint {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 1.25rem 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin: 0.25rem 0 0;
}

.kanban-cards:has(.kanban-card:not(.is-filtered-out)) .kanban-empty-hint { display: none; }
.kanban-cards.drag-over .kanban-empty-hint { display: block; opacity: 0.8; }
.lead-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.tags-inline { display: inline-flex; flex-wrap: wrap; gap: 0.2rem; max-width: 180px; }
.tags-inline .tag-badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; }

/* Informes */
.funnel-chart { display: flex; flex-direction: column; gap: 0.65rem; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.9rem; }
.funnel-bar-wrap { background: var(--border); border-radius: 6px; height: 10px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 6px; min-width: 4px; }
.funnel-meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.report-month-list, .report-sources { list-style: none; padding: 0; margin: 0; }
.report-month-list li, .report-sources li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}

/* Calendario */
.calendar-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.calendar-grid { padding: 1rem; }
.calendar-weekdays, .calendar-days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.calendar-weekdays span {
  text-align: center; font-size: 0.75rem; font-weight: 600;
  color: var(--muted); padding: 0.35rem;
}
.calendar-day {
  min-height: 88px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.35rem;
  background: var(--surface);
}
.calendar-day.empty { background: transparent; border-color: transparent; }
.calendar-day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft); }
.calendar-day-num {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  padding: 0 0.15rem;
}

.calendar-day-num:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.calendar-task {
  display: block; font-size: 0.65rem; padding: 0.15rem 0.25rem;
  margin-top: 0.2rem; border-radius: 4px;
  background: var(--primary-soft); color: var(--primary-hover);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar-task.done { opacity: 0.5; text-decoration: line-through; }
.calendar-more { font-size: 0.65rem; color: var(--muted); }

/* FAB y hint */
.fab {
  background: var(--primary);
  box-shadow: var(--shadow-md);
}

.keyboard-hint {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: var(--shadow);
}

