:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fb; }
a { color: #4f46e5; text-decoration: none; font-weight: 650; }
a:hover { color: #3730a3; }
h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -1.4px; }
h2 { margin: 0 0 16px; font-size: 20px; letter-spacing: -.3px; }
p { margin: 0 0 16px; }
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(15, 23, 42, .96); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(14px); }
.wrap { max-width: 1380px; margin: auto; padding: 0 24px; }
.nav { display: flex; min-height: 68px; gap: 22px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: #fff; font-size: 19px; letter-spacing: -.5px; }
.brand:hover { color: #fff; }
.brand b { color: #a5b4fc; }
.brand-mark { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 11px; background: linear-gradient(135deg,#6366f1,#8b5cf6); box-shadow: 0 8px 22px #312e8199; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a { padding: 9px 11px; border-radius: 8px; color: #cbd5e1; font-size: 14px; }
.nav-links a:hover { color: #fff; background: #ffffff12; }
.nav-logout { margin: 0; }
.page { padding: 34px 24px 70px; }
.page-heading { margin-bottom: 22px; }
.eyebrow { color: #6366f1; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.grid { display: grid; gap: 18px; }
.cols-4 { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit,minmax(320px,1fr)); }
.card { margin-bottom: 18px; padding: 20px; overflow: hidden; border: 1px solid #e5e9f1; border-radius: 15px; background: #fff; box-shadow: 0 8px 28px #0f172a0a; }
.card:hover { border-color: #d7dce7; }
.metric { margin: 8px 0; color: #111827; font-size: 34px; font-weight: 850; letter-spacing: -1px; }
.muted { color: #64748b; }
.small { font-size: 13px; }
.form-help { margin: -4px 0 16px; color: #64748b; font-size: 13px; }
.toolbar { display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.quick-actions details { align-self: start; }
.filters { margin-top: 4px; }
summary { display: flex; gap: 8px; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary strong { font-size: 16px; }
details[open] summary { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #edf0f5; }
.btn { display: inline-block; padding: 10px 15px; border: 0; border-radius: 9px; background: #4f46e5; color: #fff; cursor: pointer; font-weight: 750; transition: background .15s ease, transform .15s ease, box-shadow .15s ease; }
.btn:hover { background: #4338ca; color: #fff; box-shadow: 0 6px 15px #4f46e52e; transform: translateY(-1px); }
.btn.subtle { background: #eef1f6; color: #334155; }
.btn.subtle:hover { background: #e2e8f0; color: #1e293b; box-shadow: none; }
.btn.danger { background: #dc2626; }
.btn.good { background: #059669; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th,td { padding: 13px 12px; border-bottom: 1px solid #edf0f5; text-align: left; vertical-align: top; }
th { color: #64748b; background: #f8fafc; font-size: 11px; letter-spacing: .55px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e2e8f0; font-size: 12px; }
.badge.good { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
label { display: block; margin-bottom: 6px; color: #334155; font-size: 13px; font-weight: 750; }
input,select,textarea { width: 100%; margin-bottom: 14px; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 8px; outline: none; background: #fff; color: #172033; transition: border .15s ease, box-shadow .15s ease; }
input:focus,select:focus,textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 3px #6366f11c; }
input[type=checkbox] { width: auto; margin: 0; transform: scale(1.15); accent-color: #4f46e5; }
textarea { min-height: 105px; resize: vertical; }
.selection-bar { position: sticky; top: 78px; z-index: 5; margin: 18px 0 12px; padding: 13px 15px; border: 1px solid #e5e9f1; border-radius: 13px; background: #fffffff2; box-shadow: 0 8px 24px #0f172a12; backdrop-filter: blur(12px); }
.selection-bar select { width: auto; min-width: 190px; margin: 0; }
.selection-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.crm-layout { display: grid; grid-template-columns: 265px minmax(0,1fr); gap: 18px; align-items: start; }
.filter-sidebar { position: sticky; top: 84px; }
.filter-form { margin: 0; padding: 17px; }
.filter-heading { display: flex; justify-content: space-between; gap: 8px; align-items: start; margin-bottom: 14px; }
.filter-heading h2 { margin: 2px 0 0; font-size: 18px; }
.filter-form input,.filter-form select { margin-bottom: 11px; padding: 9px 10px; font-size: 13px; }
.compact { gap: 10px; }
.check-filter { display: flex; gap: 8px; align-items: center; margin: 9px 0; color: #475569; font-weight: 650; }
.filter-footer { margin: 16px -17px -17px; padding: 13px 17px; border-top: 1px solid #edf0f5; background: #fafbfc; color: #64748b; font-size: 13px; }
.list-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; padding: 15px; }
.active-filters { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.filter-chip { padding: 3px 7px; border: 1px solid #e0e7ff; border-radius: 999px; background: #eef2ff; color: #4338ca; font-size: 11px; font-weight: 700; }
.contact-table-card { padding: 0; }
.contact-table-card .empty-state { padding: 34px; }
.contact-name { display: block; color: #1e293b; font-weight: 800; }
.contact-meta { display: block; margin-top: 3px; color: #64748b; font-size: 12px; }
.status-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-contactado,.status-abierto { background: #e0f2fe; color: #075985; }
.status-respondido,.status-interesado,.status-cliente_conseguido { background: #dcfce7; color: #166534; }
.status-no_interesado { background: #fee2e2; color: #991b1b; }
.status-reunion_pendiente,.status-cliente_potencial { background: #fef3c7; color: #92400e; }
.activity-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #cbd5e1; }
.activity-dot.is-active { background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions a,.row-actions button { font: inherit; }
.mini-btn { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid #dbe3ef; border-radius: 8px; background: #fff; color: #334155; cursor: pointer; font-size: 12px; font-weight: 800; line-height: 1; box-shadow: 0 1px 2px #0f172a0a; }
.mini-btn:hover { border-color: #c7d2fe; background: #eef2ff; color: #3730a3; }
.mini-btn.good { border-color: #bbf7d0; background: #ecfdf5; color: #047857; }
.mini-btn.danger { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.mini-btn.danger:hover { background: #fee2e2; color: #991b1b; }
.action-buttons form { margin: 0; }
.metric-grid { grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card { min-height: 72px; margin-bottom: 0; padding: 12px 14px; border-radius: 12px; box-shadow: 0 4px 14px #0f172a08; }
.stat-card .muted { display: block; min-height: 18px; font-size: 12px; font-weight: 750; line-height: 1.25; }
.stat-card .metric { margin: 4px 0 0; font-size: 24px; line-height: 1; letter-spacing: -.5px; }
.stat-badge { margin-top: 17px; }
.detail-grid { grid-template-columns: minmax(0,1fr) 290px; gap: 18px; }
.stack { display: grid; gap: 8px; }
.note { margin-top: 10px; padding-top: 10px; border-top: 1px solid #edf0f5; }
.note p { margin-bottom: 4px; font-size: 14px; }
.bottom-actions { margin-top: 22px; }
.empty-state { display: grid; gap: 4px; place-items: center; color: #64748b; text-align: center; }
.inline-search { margin: 0; }
.inline-fields { display: flex; gap: 10px; align-items: center; }
.inline-fields input { margin: 0; }
.personalization-help { padding: 14px 16px; }
.personalization-list { display: grid; gap: 10px; }
.personalization-card { margin-bottom: 0; padding: 14px; }
.personalization-card textarea { min-height: 82px; margin-bottom: 0; }
.personalization-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.code-sample { margin: 10px 0 0; padding: 12px 14px; overflow-x: auto; border: 1px solid #e5e9f1; border-radius: 10px; background: #f8fafc; color: #334155; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.template-builder { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(360px,.95fr); gap: 18px; align-items: start; }
.template-editor-card,.template-preview-card { margin-bottom: 18px; }
.form-section-title { margin-bottom: 14px; }
.form-section-title h2 { margin: 2px 0 0; }
.html-editor { min-height: 120px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #1e293b; background: #fbfdff; }
.html-editor.large { min-height: 220px; }
.html-editor.full { min-height: 520px; }
.template-preview-card { position: sticky; top: 86px; padding: 0; }
.template-preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid #edf0f5; }
.template-preview-card iframe { display: block; width: 100%; min-height: 620px; border: 0; background: #f1f5f9; }
.template-list { display: grid; gap: 10px; margin-top: 6px; }
.template-item { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 0; padding: 14px 16px; }
.mobile-filter-toggle { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 9999; display: none; place-items: center; padding: 22px; background: rgba(15,23,42,.48); backdrop-filter: blur(6px); }
.modal-backdrop.is-open { display: grid; }
.modal-backdrop[hidden] { display: none !important; }
.modal-panel { width: min(620px,100%); max-height: min(86vh,820px); overflow: auto; padding: 22px; border: 1px solid #e5e9f1; border-radius: 18px; background: #fff; box-shadow: 0 24px 80px #0f172a42; }
.modal-wide { width: min(920px,100%); }
.modal-header { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid #edf0f5; }
.modal-header h2 { margin-bottom: 4px; }
.modal-close { padding: 8px 11px; border: 0; border-radius: 8px; background: #eef1f6; color: #334155; cursor: pointer; font-weight: 750; }
.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 10px; }
body.modal-open { overflow: hidden; }
.editor { min-height: 430px; padding: 16px; overflow: auto; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; }
.editor-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.login { max-width: 430px; margin: 80px auto; }
.notice { margin-bottom: 16px; padding: 12px 14px; border-radius: 9px; background: #eff6ff; color: #1e40af; }
.success { background: #ecfdf5; color: #065f46; }
.warning { background: #fff7ed; color: #9a3412; }
.error { background: #fef2f2; color: #991b1b; }
.template { display: none; }
.right { text-align: right; }
@media(max-width:900px) {
  .nav { gap: 10px; }
  .nav-links { order: 3; width: 100%; padding-bottom: 10px; overflow-x: auto; }
  .nav-links a { white-space: nowrap; }
  .selection-bar { position: static; }
  .crm-layout { grid-template-columns: 1fr; }
  .filter-sidebar { display: none; position: static; }
  .filter-sidebar.is-open { display: block; }
  .mobile-filter-toggle { display: inline-block; }
  .detail-grid { grid-template-columns: 1fr; }
  .template-builder { grid-template-columns: 1fr; }
  .template-preview-card { position: static; }
}
@media(max-width:700px) {
  .wrap { padding-right: 15px; padding-left: 15px; }
  .page { padding-top: 24px; }
  .cols-2 { grid-template-columns: 1fr; }
  .contact-table thead { display: none; }
  .contact-table,.contact-table tbody,.contact-table tr,.contact-table td { display: block; width: 100%; }
  .contact-table tr { padding: 14px; border-bottom: 1px solid #edf0f5; }
  .contact-table td { display: grid; grid-template-columns: 92px 1fr; gap: 8px; padding: 5px 0; border: 0; }
  .contact-table td::before { content: attr(data-label); color: #94a3b8; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
  .contact-table td:first-child { display: block; float: right; width: auto; }
  .selection-actions { width: 100%; }
  .selection-actions .btn,.selection-actions select { flex: 1; width: auto; }
  .stat-card { min-height: auto; }
  .modal-backdrop { align-items: end; padding: 10px; }
  .modal-panel { width: 100%; max-height: 92vh; border-radius: 16px; }
  .modal-header { gap: 10px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; text-align: center; }
  .template-item { align-items: flex-start; flex-direction: column; }
  .template-preview-card iframe { min-height: 420px; }
}

.filter-submit { width: 100%; margin: 10px 0 2px; }
