:root {
  /* Paleta oficial Rols (manual de marca):
     sand=#D7CDC5  white=#FFF  tan=#D5B38C  graphite=#4D4D4D */
  --bg-page: #FAF8F6;
  --bg-card: #FFFFFF;
  --bg-sidebar: #4D4D4D;
  --bg-sidebar-hover: #5a5a5a;
  --bg-sidebar-active: #6a6a6a;
  --text-sidebar: #D7CDC5;
  --text-sidebar-active: #FFFFFF;
  --accent: #D5B38C;
  --accent-hover: #B89368;
  --accent-soft: #EFE2CD;
  --border: #E5DCD2;
  --text-main: #2a2a2a;
  --text-muted: #7A7A7A;
  --text-graphite: #4D4D4D;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ======================== LAYOUT ======================== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar .logo-wrap { padding: 0 8px 28px; }
.sidebar .logo-wrap img {
  width: 90px; height: auto; display: block;
  filter: brightness(0) invert(1);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-radius: 8px;
  font-size: 13.5px; color: var(--text-sidebar);
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }
.sidebar nav a.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); font-weight: 500; }
.sidebar nav a .check {
  width: 16px; height: 16px; border: 1.5px solid #888879;
  border-radius: 4px; flex-shrink: 0;
}
.sidebar nav a.active .check { background: var(--accent); border-color: var(--accent); }

.sidebar .foot {
  padding-top: 16px;
  border-top: 1px solid rgba(214, 212, 200, 0.18);
  font-size: 11px;
  color: rgba(214, 212, 200, 0.55);
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar .foot .logout-link {
  color: rgba(214, 212, 200, 0.7);
  font-size: 11.5px;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: none;
}
.sidebar .foot .logout-link:hover {
  color: var(--accent);
}

/* ======================== LOGIN PAGE ======================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 48px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px -28px rgba(77, 77, 77, 0.18);
  text-align: center;
}
.login-logo {
  width: 80px;
  height: auto;
  display: block;
  margin: 0 auto 18px;
}
.login-card h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-graphite);
  margin: 0 0 4px;
}
.login-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}
.login-form {
  text-align: left;
}
.login-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.login-form input[type=password] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input[type=password]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(213, 179, 140, 0.15);
}
.login-form button {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.login-form button:hover { background: var(--accent-hover); }
.login-error {
  color: #8C2E25;
  background: #FDE6E3;
  border: 1px solid #F4C7C0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0 0 14px;
  text-align: center;
}

main.content {
  flex-grow: 1;
  padding: 32px 40px;
  overflow-x: hidden;
}

/* ======================== TOP BAR ======================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 24px;
}
.breadcrumb { font-size: 13px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.range-form { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.range-form label { color: var(--text-muted); }
.range-form select,
.range-form input[type=date] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}
.range-form select:focus,
.range-form input[type=date]:focus { border-color: var(--accent); }
.range-form .custom-dates {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.range-form .custom-dates[hidden] { display: none; }
.range-form .dash { color: var(--text-muted); }
.range-form .btn-apply {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.range-form .btn-apply:hover { background: var(--accent-hover); }
.hide-partials-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.hide-partials-toggle input { cursor: pointer; accent-color: var(--accent); }

/* ======================== TITLE ======================== */
h1.page-title {
  font-size: 28px;
  font-weight: 300;
  color: var(--text-graphite);
  margin: 0 0 6px;
}
h1.page-title .accent {
  font-weight: 500;
  position: relative;
}
h1.page-title .accent::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: var(--text-graphite);
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
  max-width: 640px;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-graphite);
  margin: 0 0 14px;
}
h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-hover);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ======================== KPIS ======================== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi .k-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi .k-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-graphite);
}
.kpi .delta {
  display: inline-block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
}
.delta-up    { background: #DCEFE2; color: #1F5D2C; }
.delta-down  { background: #FDE6E3; color: #8C2E25; }
.delta-flat  { background: rgba(0,0,0,0.04); color: var(--text-muted); }
.delta-new   { background: var(--accent-soft); color: var(--accent-hover); }

/* ======================== CARDS ======================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.card.warn { background: #FFFAF0; border-color: #FED7AA; }
.card .lead { font-size: 15px; line-height: 1.6; color: var(--text-graphite); }

/* ======================== TABLE ======================== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 14px 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: #FAF8F6;
}
table.data tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-main);
  border-bottom: 1px solid #F2EDE8;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #FAF8F6; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
  font-style: italic;
}
table.data a { color: var(--accent-hover); }
table.data a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
table.data .ai-summary {
  color: var(--text-muted);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tabla con secciones agrupadas (Comerciales -> Desglose -> Direccion) */
.data-grouped col.col-bd { background: #FBF6EF; }
.data-grouped .head-super th { padding: 6px 12px; font-weight: 600; }
.data-grouped .head-super .supertitle {
  text-align: center;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hover);
  border-bottom: 1px solid var(--border);
  background: #FBF6EF;
}
.data-grouped thead tr:nth-child(2) th {
  vertical-align: top;
  line-height: 1.2;
}
.data-grouped thead th small {
  display: block;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-muted);
  margin-top: 2px;
}
.data-grouped thead th.bd {
  background: #FBF6EF;
}
.data-grouped td.bd { background: #FCF9F4; }
.data-grouped tbody tr:hover td.bd { background: #F5ECDB; }

.hdot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.hdot-answered  { background: #5cba78; }
.hdot-voicemail { background: var(--accent); }
.hdot-breve     { background: #A8A29E; }
.hdot-missed    { background: #C0392B; }

/* Drill-down inline de Contestadas: 3 pildoritas pequenas con tooltip */
.contestadas-mix {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mix {
  display: inline-block;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 999px;
  cursor: help;
}
.mix-disc  { background: #DCEFE2; color: #1F5D2C; }
.mix-folup { background: var(--accent-soft); color: var(--accent-hover); }
.mix-unk   { background: #EEE9E2; color: #5a5550; }

/* Etiqueta con tooltip via 'title': underline punteado + cursor help */
.th-help {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
}
.th-help:hover { color: var(--accent-hover); border-bottom-color: var(--accent); }

.pct {
  display: inline-block;
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0,0,0,0.04);
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* Pendientes: badges de antiguedad */
.age-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.age-fresh  { background: #DCEFE2; color: #1F5D2C; }
.age-mid    { background: var(--accent-soft); color: var(--accent-hover); }
.age-warn   { background: #FFF1E3; color: #8C5106; border: 1px solid #FDD9B5; }
.age-urgent { background: #FDE6E3; color: #8C2E25; border: 1px solid #F4C7C0; }
tr.row-warn td { background: #FFFAF0; }
tr.row-urgent td { background: #FDF6F4; }

.actions-cell { white-space: nowrap; }
.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  margin-right: 4px;
  font-size: 13px;
  transition: background 0.12s, transform 0.12s;
}
.act-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }
.act-hubspot { background: #FFE4D5; color: #FF7A59; }
.act-hubspot:hover { background: #FF7A59; color: #fff; }

.badge-outcome {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid #E2C9A9;
}

/* ======================== STATUS BADGES ======================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}
.badge-answered  { background: #D6EFD6; color: #1F5D2C; }
.badge-missed,
.badge-noanswer,
.badge-cancelled,
.badge-failed    { background: #F3D4D4; color: #6F1F1f; }
.badge-voicemail { background: #F3E5D0; color: #6B4A25; }
.badge-breve     { background: #E7E5E0; color: #5a5550; }
.badge-unknown   { background: #EFE7DF; color: var(--text-muted); }

/* Tipo de llamada (discovery vs seguimiento) */
.ctype {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em;
}
.ctype-discovery { background: #E4F4E9; color: #1F5D2C; border: 1px solid #C6E6CF; }
.ctype-followup  { background: #EFE2CD; color: var(--accent-hover); border: 1px solid #E2C9A9; }

/* Discovery info section */
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.discovery-grid > div { padding: 4px; }
.discovery-value {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  display: inline-block;
  border: 1px solid var(--border);
}
.status-activo        { background: #DCEFE2; color: #1F5D2C; border-color: #C6E6CF; }
.status-buscando_info { background: #E2EAF0; color: #294F6B; border-color: #C7D5DE; }
.status-futuro        { background: var(--accent-soft); color: var(--accent-hover); border-color: #E2C9A9; }
.exp-experimentado    { background: #DCEFE2; color: #1F5D2C; border-color: #C6E6CF; }
.exp-novato           { background: var(--accent-soft); color: var(--accent-hover); border-color: #E2C9A9; }
.source-anuncio         { background: #FDE6E3; color: #8C2E25; border-color: #F4C7C0; }
.source-conocido_previo { background: #DCEFE2; color: #1F5D2C; border-color: #C6E6CF; }
.source-recomendacion   { background: var(--accent-soft); color: var(--accent-hover); border-color: #E2C9A9; }
.source-busqueda_web    { background: #E2EAF0; color: #294F6B; border-color: #C7D5DE; }
.source-feria           { background: #EFE2CD; color: var(--accent-hover); border-color: #E2C9A9; }
.ctype-tienda           { background: var(--accent-soft); color: var(--accent-hover); border-color: #E2C9A9; }
.ctype-interiorista     { background: #E2EAF0; color: #294F6B; border-color: #C7D5DE; }
.ctype-arquitecto       { background: #EDE4F3; color: #4a2c6b; border-color: #DDD0E8; }
.ctype-contract         { background: #DCEFE2; color: #1F5D2C; border-color: #C6E6CF; }
.ctype-particular       { background: #F3E5D0; color: #6B4A25; border-color: #E5D5B5; }
.ctype-otro             { background: #EFE7DF; color: var(--text-muted); border-color: var(--border); }
.qual-sql               { background: #DCEFE2; color: #1F5D2C; border-color: #C6E6CF; }
.qual-evaluar           { background: var(--accent-soft); color: var(--accent-hover); border-color: #E2C9A9; }
.qual-no_cualificado    { background: #FDE6E3; color: #8C2E25; border-color: #F4C7C0; }

/* ======================== CHIPS / TAGS ======================== */
.chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips li {
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #E2C9A9;
}
.chips.chips-sm { gap: 4px; }
.chips.chips-sm li { padding: 1px 7px; font-size: 10.5px; line-height: 1.5; }

/* Celda 'Sugerencias de mejora': truncada por defecto, click para expandir */
.cell-suggest { max-width: 380px; }
.suggest-details > summary {
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  transition: color 0.12s;
}
.suggest-details > summary::-webkit-details-marker { display: none; }
.suggest-details > summary::marker { display: none; content: ''; }
.suggest-details > summary:hover { color: var(--accent-hover); }
.suggest-details[open] > summary {
  white-space: normal;
  overflow: visible;
  color: var(--text-graphite);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #E2C9A9;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.tag-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #F2EDE8;
}
.tag-list li:last-child { border-bottom: 0; }
.tag-list .tag { color: var(--text-graphite); font-size: 14px; }
.tag-list .count {
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: var(--accent-soft);
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* ======================== GRID 2 ======================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ======================== CALL DETAIL ======================== */
.call-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  color: var(--text-muted);
  margin: 12px 0 16px;
  font-size: 13px;
}
.call-meta b { color: var(--text-graphite); font-weight: 500; }
.call-header audio { width: 100%; margin-top: 12px; border-radius: 10px; }

.transcript {
  background: #FAF8F6;
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 640px;
  overflow-y: auto;
  color: var(--text-graphite);
}

/* Speakers en el transcript */
.transcript .sp-comercial { color: var(--accent-hover); font-weight: 600; }
.transcript .sp-cliente { color: #2c4a6b; font-weight: 600; }

/* ======================== MISC ======================== */
.muted { color: var(--text-muted); }
.empty { color: var(--text-muted); font-style: italic; }
.crumbs { color: var(--text-muted); margin-bottom: 16px; font-size: 13px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--accent); }
code {
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

/* ======================== INSIGHTS ======================== */
.filter-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; font-size: 13px; color: var(--text-muted);
}
.filter-row select {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; font-size: 13px; color: var(--text-main); outline: none;
}
.filter-row select:focus { border-color: var(--accent); }
.filter-clear {
  font-size: 12px; color: var(--text-muted); margin-left: 8px;
  text-decoration: underline; text-underline-offset: 3px;
}
.filter-clear:hover { color: var(--accent); }

/* Sentimiento / outcome bars */
.sent-row {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.sent-row:last-child { margin-bottom: 0; }
.sent-label { font-weight: 600; color: var(--text-graphite); }
.sent-label.sent-pos { color: #1F5D2C; }
.sent-label.sent-neu { color: var(--text-muted); }
.sent-label.sent-neg { color: #6F1F1F; }
.sent-bar {
  background: #F2EDE8; height: 10px; border-radius: 999px; overflow: hidden;
}
.sent-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.sent-fill.sent-pos { background: #5cba78; }
.sent-fill.sent-neu { background: var(--text-muted); }
.sent-fill.sent-neg { background: #C0392B; }
.sent-num { font-size: 13px; text-align: right; }

/* Listas con barras horizontales (preguntas, objeciones) */
.bar-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.bar-list li {
  display: grid;
  grid-template-columns: 1fr 130px 40px;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}
.bar-label {
  color: var(--text-graphite);
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand-logo {
  width: 18px; height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
  padding: 1px;
  object-fit: contain;
}
.brand-link {
  color: var(--text-graphite);
  border-bottom: 1px dashed var(--border);
}
.brand-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.bar-track {
  background: #F2EDE8; height: 8px; border-radius: 999px; overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 999px;
}
.bar-count {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--accent-hover);
}

/* Nube de chips con contador */
.chips-cloud {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chips-cloud li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft);
  border: 1px solid #E2C9A9;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--accent-hover);
}
.chip-count {
  background: var(--accent-hover); color: #fff;
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  min-width: 22px; text-align: center;
}

/* ======================== SEARCH ======================== */
.search-form {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 6px 6px 18px;
  max-width: 720px; margin-bottom: 8px;
  box-shadow: 0 4px 14px -10px rgba(77, 77, 77, 0.2);
}
.search-form input[type=text] {
  flex: 1; border: none; outline: none; font-size: 14px;
  background: transparent; color: var(--text-main); padding: 10px 4px;
  font-family: inherit;
}
.search-form button {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 22px; border-radius: 999px; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: background 0.15s;
}
.search-form button:hover { background: var(--accent-hover); }

/* Lista expandible con contactos */
.bar-list-detail { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.bar-list-detail > li { border-radius: 10px; }
.bar-list-detail > li:hover { background: #FAF8F6; }
.bar-list-detail details > summary {
  display: grid;
  grid-template-columns: 1fr 130px 40px 16px;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 13.5px;
  list-style: none;
}
.bar-list-detail details > summary::-webkit-details-marker { display: none; }
.bar-list-detail details > summary::after {
  content: "›";
  font-size: 18px; color: var(--text-muted);
  transition: transform 0.15s;
}
.bar-list-detail details[open] > summary::after { transform: rotate(90deg); }

.contact-list {
  list-style: none;
  padding: 8px 12px 12px 14px;
  margin: 0 6px 4px;
  background: #FAF8F6;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-list > li { padding: 6px 0; border-bottom: 1px solid #F2EDE8; }
.contact-list > li:last-child { border-bottom: none; padding-bottom: 0; }
.ct-when {
  font-size: 12px; font-weight: 600;
  color: var(--accent-hover); display: inline-block;
}
.ct-when:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.ct-info { font-size: 13.5px; color: var(--text-graphite); margin-top: 2px; }
.ct-info b { color: var(--text-main); }
.ct-channels {
  margin-top: 4px; font-size: 12.5px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 0 6px;
}
.ct-channels a { color: var(--accent-hover); }
.ct-channels a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* HubSpot link inline (icono al lado del nombre) */
.hubspot-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #FF7A59;
  vertical-align: middle;
  transition: background 0.15s, transform 0.15s;
}
.hubspot-link:hover { background: #FFE4D5; transform: scale(1.1); }
.hubspot-link svg { display: block; }

/* Boton CTA HubSpot en la ficha de llamada */
.hubspot-cta { margin: 14px 0 6px; }
.btn-hubspot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FF7A59;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: background 0.15s;
}
.btn-hubspot:hover { background: #E55A35; color: #fff; }
.btn-hubspot svg { color: #fff; }

/* ======================== CHARTS ======================== */
.chart-card { padding-bottom: 18px; }
.chart-box {
  position: relative;
  width: 100%;
  height: 240px;
}

/* ======================== COACHING CARD ======================== */
.coaching-card { padding: 24px 28px; }
.coach-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.coach-head h2 { margin: 0; }
.coach-meta { font-size: 12px; }
.coach-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.coach-control-label {
  font-size: 12px;
  color: var(--text-muted);
}
.coach-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}
.coach-controls select:focus { border-color: var(--accent); }
.coach-controls select:disabled { opacity: 0.6; cursor: progress; }
.coaching-card .lead {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-graphite);
  margin: 8px 0 18px;
}
.coach-grid { gap: 14px; }
.coach-block {
  border-left: 3px solid var(--border);
  padding: 6px 14px 8px;
  background: #FAF8F6;
  border-radius: 0 10px 10px 0;
}
.coach-block h3 {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 6px 0 8px;
  color: var(--text-muted);
}
.coach-block ul {
  margin: 0; padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-graphite);
  line-height: 1.55;
}
.coach-block li { margin-bottom: 6px; }
.coach-block li:last-child { margin-bottom: 0; }

.coach-positive {
  border-left-color: #5cba78;
  background: #F0F8F2;
}
.coach-positive h3 { color: #1F5D2C; }

.coach-improve {
  border-left-color: var(--accent);
  background: #FBF6EF;
}
.coach-improve h3 { color: var(--accent-hover); }

.coach-warn {
  border-left-color: #C0392B;
  background: #FDF2F1;
  margin-top: 16px;
}
.coach-warn h3 { color: #8C2E25; }

/* Refs clicables dentro de cada item del coaching */
.coach-text { display: inline; }
.coach-refs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.coach-ref {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 8px;
  border-radius: 999px;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.coach-positive .coach-ref:hover { background: #DCEFE2; border-color: #5cba78; color: #1F5D2C; }
.coach-improve  .coach-ref:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.coach-warn     .coach-ref:hover { background: #FDE6E3; border-color: #C0392B; color: #8C2E25; }
@media (max-width: 900px) {
  .chart-box { height: 200px; }
}

/* ======================== COMPANY IMPROVEMENTS ======================== */
.improvements-card .lead { margin: 8px 0 18px; }
.improvements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.imp-block {
  border-left: 3px solid var(--border);
  padding: 8px 14px 10px;
  background: #FAF8F6;
  border-radius: 0 10px 10px 0;
}
.imp-block h3 {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 4px 0 8px;
}
.imp-block ul {
  margin: 0; padding-left: 18px;
  font-size: 13px;
  color: var(--text-graphite);
  line-height: 1.55;
}
.imp-block li { margin-bottom: 8px; }
.imp-block li:last-child { margin-bottom: 0; }

.imp-marketing      { border-left-color: #C0392B; background: #FDF2F1; }
.imp-marketing h3   { color: #8C2E25; }
.imp-producto       { border-left-color: var(--accent); background: #FBF6EF; }
.imp-producto h3    { color: var(--accent-hover); }
.imp-disponibilidad { border-left-color: #d97706; background: #FFF7ED; }
.imp-disponibilidad h3 { color: #8C5106; }
.imp-web            { border-left-color: #294F6B; background: #EFF3F7; }
.imp-web h3         { color: #294F6B; }
.imp-proceso        { border-left-color: #5cba78; background: #F0F8F2; }
.imp-proceso h3     { color: #1F5D2C; }
.imp-precio         { border-left-color: #4a2c6b; background: #F3EEF7; }
.imp-precio h3      { color: #4a2c6b; }

/* Boton de regenerar */
.btn-regen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid #E2C9A9;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-regen:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-regen:disabled {
  cursor: progress;
  opacity: 0.85;
}
.btn-regen-loading svg {
  animation: spin 1.2s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
