/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Barlow', sans-serif; background: #F4F3EF; color: #1A1A1A; min-height: 100vh; }

/* ── VARIABLES ── */
:root {
  --yellow: #F5C800;
  --yellow-dark: #D4AC00;
  --primary: #F5C800;
  --primary-dark: #D4AC00;
  --black: #1A1A1A;
  --gray-900: #2C2C2C;
  --gray-700: #4A4A4A;
  --gray-600: #616161;
  --gray-500: #7A7A7A;
  --gray-300: #C8C8C8;
  --gray-400: #A8A7A3;
  --gray-200: #DDDCD8;
  --gray-100: #F0EFEB;
  --gray-50: #FAF9F7;
  --white: #FFFFFF;
  --bg: #F4F3EF;
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --danger: #D64045;
  --success: #3A7D44;
  --warning: #C97D0C;
  --info: #1B5FA8;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(245,200,0,0.03) 40px,
    rgba(245,200,0,0.03) 80px
  );
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
}
.logo-mark {
  width: 44px;
  height: 44px;
  background: var(--yellow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; }
.logo-main { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 1px; color: var(--black); line-height: 1; }
.logo-sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input {
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus { border-color: var(--yellow-dark); }
.login-error { font-size: 13px; color: var(--danger); min-height: 20px; }
.btn-login {
  padding: 12px;
  background: var(--yellow);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--black);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-login:hover { background: var(--yellow-dark); }
.btn-login:active { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-footer { font-size: 12px; color: var(--gray-500); text-align: center; margin-top: 1.5rem; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}
.brand-mark {
  width: 36px;
  height: 36px;
  background: var(--yellow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  flex-shrink: 0;
}
.brand-info { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 700; color: var(--white); letter-spacing: 1px; line-height: 1; }
.brand-role { font-size: 10px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: var(--gray-100); color: var(--black); }
.nav-link.active { background: rgba(245,200,0,0.22); color: var(--black); font-weight: 600; box-shadow: inset 2px 0 0 var(--yellow); }
.nav-link.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--gray-200); }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-logout svg { width: 14px; height: 14px; }
.btn-logout:hover { background: var(--gray-100); color: var(--black); }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  padding: 12px 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-700);
  padding: 4px;
}
.menu-toggle svg { width: 20px; height: 20px; }
.page-title { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 700; color: var(--black); line-height: 1; }
.page-sub { font-size: 12px; color: var(--gray-500); margin-top: 1px; }

.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--yellow);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary svg { width: 14px; height: 14px; }
.btn-primary:hover { background: var(--yellow-dark); }
.btn-primary:active { transform: scale(0.97); }

/* ── PAGE CONTENT ── */
.page-content { flex: 1; padding: 1.5rem; }
.view { display: none; }
.view.active { display: block; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.07);
  overflow: hidden;
}
.table-card {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* ── METRICS ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.07);
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s, transform 0.1s;
}
.metric-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.06); transform: translateY(-1px); }
.metric-label { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.metric-value { font-family: 'Barlow Condensed', sans-serif; font-size: 30px; font-weight: 700; color: var(--black); line-height: 1; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: 11px; color: var(--gray-500); margin-top: 4px; }
/* Cards de divisa: card limpia con acento amarillo lateral (estilo HD, on-brand) */
.metric-card.highlight { border-left: 3px solid var(--yellow); }
.metric-card.highlight .metric-value { color: var(--black); }

/* Valor cotizado por divisa */
.dash-cot-title { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 8px; }
.cotizado-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.5rem; }
@media (max-width: 700px) { .cotizado-grid { grid-template-columns: 1fr; } }

/* Combobox buscador de prospectos */
.combo-wrap { position: relative; }
.combo-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 50; background: #fff; border: 1.5px solid var(--gray-200); border-radius: 8px; margin-top: 4px; max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.combo-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--gray-100); }
.combo-item:last-child { border-bottom: none; }
.combo-item:hover { background: var(--gray-50); }
.combo-empty { padding: 10px 12px; font-size: 12px; color: var(--gray-400); }

/* Modal genérico (perfil) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); font-weight: 700; font-size: 15px; }
.modal-x { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--gray-500); line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--gray-200); }

/* ── DASHBOARD GRID ── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ── DASHBOARD CHARTS ── */
.dash-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.5rem; }
.chart-card { background: var(--white); border-radius: var(--radius); border: 1px solid rgba(0,0,0,0.07); padding: 1rem 1.25rem; }
.chart-title { font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.dash-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dash-bar-row:last-child { margin-bottom: 0; }
.dash-bar-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-bar-label { font-size: 12px; color: var(--gray-700); width: 130px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track { flex: 1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.dash-bar-count { font-size: 13px; font-weight: 700; color: var(--black); width: 28px; text-align: right; flex-shrink: 0; }
@media (max-width: 640px) { .dash-charts-grid { grid-template-columns: 1fr; } .dash-bar-label { width: 100px; } }
.section-title { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ── TASK ITEMS ── */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  transition: background 0.1s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--gray-100); }
.task-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.task-check.done { background: var(--success); border-color: var(--success); }
.task-text { flex: 1; font-size: 13px; color: var(--black); }
.task-text.done { text-decoration: line-through; color: var(--gray-500); }
.task-due { font-size: 11px; color: var(--gray-500); white-space: nowrap; }
.task-due.overdue { color: var(--danger); font-weight: 600; }

/* ── ACTIVITY ITEMS ── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  transition: background 0.1s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--gray-100); }
.activity-text { flex: 1; }
.activity-empresa { font-size: 12px; font-weight: 600; color: var(--black); }
.activity-desc { font-size: 11px; color: var(--gray-500); margin-top: 1px; }
.activity-date { font-size: 10px; color: var(--gray-500); white-space: nowrap; margin-top: 2px; }

/* ── TAGS ── */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-venta { background: #DBEAFE; color: #1D4ED8; }
.tag-renta { background: #FEF3C7; color: #92400E; }
.tag-prospecto { background: #F1EFE8; color: #5F5E5A; }
.tag-contactado { background: #DBEAFE; color: #1B5FA8; }
.tag-demo { background: #FEF3C7; color: #92400E; }
.tag-propuesta { background: #D1FAE5; color: #065F46; }
.tag-negociacion { background: #EDE9FE; color: #5B21B6; }
.tag-vendido { background: #D1FAE5; color: #065F46; font-weight: 700; }
.tag-borrador { background: #F1EFE8; color: #5F5E5A; }
.tag-enviada { background: #D1FAE5; color: #065F46; }
.tag-revision { background: #FEF3C7; color: #92400E; }
.tag-aceptada { background: #D1FAE5; color: #065F46; }
.tag-rechazada { background: #FEE2E2; color: #991B1B; }
.tag-construccion { background: #DBEAFE; color: #1D4ED8; }
.tag-mineria { background: #D1FAE5; color: #065F46; }
.tag-infraestructura { background: #EDE9FE; color: #5B21B6; }
.tag-arrendadora { background: #FEF3C7; color: #92400E; }
.tag-agricultura { background: #D1FAE5; color: #166534; }
.tag-industria { background: #F1EFE8; color: #374151; }

/* ── PRIORITY DOT ── */
.prio-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.prio-alto { background: var(--danger); }
.prio-medio { background: var(--warning); }
.prio-bajo { background: var(--success); }

/* ── PIPELINE (estilo HD — columnas fijas + scroll horizontal) ── */
.pipeline-board {
  display: flex;
  gap: 14px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 8px;
  min-width: max-content;
}
.stage-column {
  flex: 0 0 264px;
  width: 264px;
  background: #FAFAFB;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 12px;
  padding: 10px 10px 14px;
  min-height: 420px;
  transition: background 0.15s, border-color 0.15s;
}
.stage-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 4px 0;
  margin-bottom: 12px;
}
.stage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stage-name { font-size: 10.5px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.6px; }
.stage-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  background: rgba(0,0,0,0.06);
  padding: 1px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
/* Badge de antigüedad "Xd" en la tarjeta */
.kanban-age {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  color: var(--gray-500);
  white-space: nowrap;
}
.kanban-age.age-warning { background: #FEF3C7; color: #B45309; }
.kanban-age.age-danger  { background: #FEE2E2; color: #B91C1C; }
.stage-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.stage-empty {
  text-align: center;
  color: var(--gray-400);
  font-size: 12px;
  padding: 28px 0;
  user-select: none;
}
.kanban-card {
  background: var(--white);
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.kanban-card:hover { border-color: rgba(0,0,0,0.18); box-shadow: 0 4px 14px rgba(0,0,0,0.07); transform: translateY(-1px); }
.kanban-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.kanban-empresa { font-size: 13px; font-weight: 700; color: var(--black); line-height: 1.25; }
.kanban-contacto { font-size: 11.5px; color: var(--gray-500); }
.kanban-equipo { font-size: 11px; color: var(--gray-600); margin-top: 6px; }
.kanban-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.kanban-valor { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: var(--black); white-space: nowrap; }
.kanban-divisa { font-family: inherit; font-size: 9.5px; font-weight: 600; color: var(--gray-400); margin-left: 3px; letter-spacing: 0.3px; }
.kanban-vendedor { font-size: 10.5px; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-vendido { border-color: rgba(34,197,94,0.35); }
.kanban-vendido { border-left: 3px solid var(--success); }
.stage-perdido { border-color: rgba(248,113,113,0.30); }
.kanban-perdido { border-left: 3px solid var(--danger); opacity: 0.85; }

/* ── MASTER-DETAIL (Contactos estilo HD) ── */
.md-layout { display: flex; gap: 16px; height: calc(100vh - 112px); }
.md-list {
  width: 340px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}
.md-list-head { padding: 12px; border-bottom: 1px solid var(--gray-200); display: flex; flex-direction: column; gap: 8px; }
.md-list-head .search-wrapper { width: 100%; }
.md-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.md-chips .filter-select { flex: 1 1 45%; min-width: 0; font-size: 12px; border-radius: 8px; }
.md-list-scroll { flex: 1; overflow-y: auto; padding: 6px; }
.md-list-empty { padding: 28px 12px; text-align: center; color: var(--gray-400); font-size: 13px; }

.contacto-list-item {
  padding: 11px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background 0.12s, border-color 0.12s;
}
.contacto-list-item + .contacto-list-item { margin-top: 2px; }
.contacto-list-item:hover { background: var(--gray-50); }
.contacto-list-item.active { background: rgba(245,200,0,0.14); border-color: rgba(245,200,0,0.5); }
.cli-top { display: flex; align-items: center; gap: 8px; }
.cli-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cli-name { font-size: 13.5px; font-weight: 700; color: var(--black); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-sub { font-size: 11.5px; color: var(--gray-500); margin: 3px 0 0 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-foot { display: flex; align-items: center; gap: 8px; margin: 7px 0 0 16px; }
.cli-vend { font-size: 10.5px; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Cotizaciones master-detail: folio (derecha del nombre) y total (derecha del pie) */
.cli-folio { margin-left: auto; flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: var(--gray-400); white-space: nowrap; }
.cli-total { margin-left: auto; flex-shrink: 0; font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: var(--black); white-space: nowrap; }

.md-detail { flex: 1; overflow-y: auto; min-width: 0; padding-right: 2px; }
.md-detail-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 14px; text-align: center; }

@media (max-width: 900px) {
  .md-layout { flex-direction: column; height: auto; }
  .md-list { width: 100%; max-height: 60vh; }
}

/* ── DATA TABLE ── */
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: left;
  background: var(--gray-50);
}
.data-table td {
  font-size: 13px;
  color: var(--black);
  padding: 11px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover td { background: var(--gray-50); }
.company-cell { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--black);
  flex-shrink: 0;
}
.td-main { font-weight: 600; }
.td-sub { font-size: 11px; color: var(--gray-500); margin-top: 1px; }

/* ── DETALLE / FORMS ── */
.detalle-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.25rem; align-items: start; }
.panel {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.07);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* Detalle de prospecto — barra de etapa + botón avanzar (estilo HD) */
.dr-stagebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }
.dr-advance { font-size: 12px; padding: 7px 14px; }
.ro-link { color: var(--info); text-decoration: none; font-weight: 500; }
.ro-link:hover { text-decoration: underline; }
.panel-title { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.field-label { font-size: 11px; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--yellow-dark); }
.field-textarea { resize: vertical; min-height: 60px; }
.divider { border: none; border-top: 1px solid rgba(0,0,0,0.07); margin: 1rem 0; }

/* ── TOTALS BOX ── */
.totals-box {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}
.total-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--gray-700); }
.total-row.main { border-top: 1px solid rgba(0,0,0,0.1); margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 700; color: var(--black); }
.total-row.discount { color: var(--danger); }

/* ── ACTIONS ── */
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
.btn-secondary {
  padding: 8px 16px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--gray-100); }
.btn-danger {
  padding: 8px 16px;
  background: var(--white);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #FEE2E2; }

/* ── HISTORIAL LOGS ── */
.log-entry { padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.log-entry:last-child { border-bottom: none; }
.log-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.log-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.log-llamada { background: #DBEAFE; color: #1D4ED8; }
.log-email { background: #D1FAE5; color: #065F46; }
.log-visita { background: #FEF3C7; color: #92400E; }
.log-whatsapp { background: #DCFCE7; color: #166534; }
.log-date { font-size: 11px; color: var(--gray-500); }
.log-text { font-size: 12px; color: var(--black); }
.log-empty { font-size: 12px; color: var(--gray-500); padding: 8px 0; }

/* ── COT PREVIEW ── */
.cot-preview-header {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
.cot-logo { display: flex; align-items: center; gap: 10px; }
.cot-logo .logo-mark { width: 36px; height: 36px; font-size: 20px; }
.cot-company-info { }
.cot-company-name { font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 700; }
.cot-company-sub { font-size: 11px; color: var(--gray-500); }
.cot-folio-info { text-align: right; }
.cot-folio { font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 700; }
.cot-date { font-size: 11px; color: var(--gray-500); }

/* ── LINKED COTS ── */
.cot-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
}
.cot-link-item:last-child { border-bottom: none; }
.cot-link-item:hover { opacity: 0.8; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--black);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideUp { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ── LOADING ── */
.loading-state { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--gray-500); font-size: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; color: var(--gray-500); text-align: center; gap: 8px; }
.empty-state svg { width: 32px; height: 32px; opacity: 0.3; }
.empty-state p { font-size: 13px; }

/* ── SIDEBAR OVERLAY (mobile) ── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  cursor: pointer;
}
#sidebar-overlay.visible { display: block; }

/* ── BOTONES ICONO PEQUEÑO (acciones en tablas) ── */
.btn-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-icon-sm svg { width: 13px; height: 13px; }
.btn-icon-sm:hover { background: var(--gray-300); color: var(--black); }
.btn-icon-sm.danger { color: var(--danger); }
.btn-icon-sm.danger:hover { background: #FEE2E2; border-color: var(--danger); }

/* ── TAREA COMPLETADA ── */
.tarea-done { text-decoration: line-through; color: var(--gray-500); }

/* ── TAGS FALTANTES ── */
.tag-calificado { background: #E0F2FE; color: #0369A1; }
.tag-perdido { background: #FEE2E2; color: #991B1B; }

/* ── VIEW FILTERS (barras de búsqueda) ── */
.view-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--gray-500);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { border-color: var(--yellow-dark); box-shadow: 0 0 0 3px rgba(245,200,0,0.12); }
.search-input::placeholder { color: var(--gray-500); }
.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--gray-700);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.filter-select:hover { border-color: var(--gray-300); }
.filter-select:focus { border-color: var(--yellow-dark); box-shadow: 0 0 0 3px rgba(245,200,0,0.12); }
.btn-link {
  background: none;
  border: none;
  color: var(--info);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  transition: color 0.15s;
}
.btn-link:hover { color: #1041A0; }

/* ── CHAT FLOTANTE ── */
.chat-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--black);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 200;
  transition: background 0.15s, transform 0.15s;
}
.chat-btn svg { width: 22px; height: 22px; }
.chat-btn:hover { background: var(--gray-900); transform: scale(1.05); }
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 5px;
  min-width: 18px;
  text-align: center;
  border: 2px solid var(--white);
  line-height: 1.2;
}

/* ── PANEL DE CHAT ── */
.chat-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 320px;
  height: 460px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 199;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn 0.2s ease;
}
.chat-panel.hidden { display: none; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--black);
  color: var(--white);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.chat-close-btn svg { width: 16px; height: 16px; }
.chat-close-btn:hover { color: var(--white); }

/* Lista de usuarios */
.chat-user-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.chat-list-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 14px 8px;
}
.chat-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.chat-user-item:hover { background: var(--gray-100); }
.chat-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
  flex-shrink: 0;
  position: relative;
}
.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gray-300);
  border: 2px solid var(--white);
  position: absolute;
  bottom: -1px;
  right: -1px;
  flex-shrink: 0;
}
.presence-dot.online { background: var(--success); }
.chat-user-info { flex: 1; min-width: 0; }
.chat-user-name { font-size: 13px; font-weight: 600; color: var(--black); }
.chat-user-status { font-size: 11px; color: var(--gray-500); }
.chat-unread-badge {
  background: var(--danger);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* Hilo de conversación */
.chat-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-thread.hidden { display: none; }
.chat-thread-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.chat-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-700);
  padding: 2px;
  display: flex;
  align-items: center;
}
.chat-back-btn svg { width: 16px; height: 16px; }
.chat-back-btn:hover { color: var(--black); }
.chat-thread-name { font-size: 13px; font-weight: 600; color: var(--black); flex: 1; }
#chat-thread-presence { position: relative; flex-shrink: 0; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg.mine .chat-bubble {
  background: var(--black);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.chat-msg.theirs .chat-bubble {
  background: var(--gray-100);
  color: var(--black);
  border-bottom-left-radius: 4px;
}
.chat-msg-time {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 3px;
  padding: 0 4px;
}
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--gray-500);
  font-size: 12px;
  text-align: center;
  gap: 6px;
}
.chat-empty svg { width: 28px; height: 28px; opacity: 0.3; }
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: 20px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--black);
  background: var(--gray-100);
  outline: none;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--yellow-dark); background: var(--white); }
.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--black);
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.chat-send-btn svg { width: 14px; height: 14px; }
.chat-send-btn:hover { background: var(--yellow-dark); }
.chat-send-btn:active { transform: scale(0.93); }

/* ── GARANTÍA BUTTONS ── */
.btn-garantia {
  padding: 6px 12px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: 'Barlow', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-garantia:hover { border-color: var(--yellow-dark); background: #FFFBEA; }
.btn-garantia.active { background: var(--yellow); border-color: var(--yellow-dark); color: var(--black); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); z-index: 100; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-board { overflow-x: auto; padding-bottom: 1rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .detalle-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 1rem; }
}

@media (max-width: 640px) {
  /* Layout base */
  .page-content { padding: 0.75rem; }
  .topbar { padding: 0 0.75rem; height: 52px; }
  .page-title { font-size: 15px; }
  .page-sub { display: none; }

  /* Métricas y grids */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .metric-card { padding: 0.75rem; }
  .metric-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-full { grid-column: span 1; }

  /* Pipeline: scroll horizontal en móvil */
  .pipeline-board {
    display: flex; flex-direction: row;
    overflow-x: auto; gap: 0.75rem;
    padding-bottom: 1rem; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .stage-column {
    min-width: 240px; max-width: 260px;
    scroll-snap-align: start; flex-shrink: 0;
  }

  /* Tablas: scroll horizontal */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 520px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }

  /* Filtros en columna */
  .view-filters { flex-direction: column; gap: 8px; }
  .search-wrapper { width: 100%; }
  .search-input { width: 100%; }
  .filter-select { width: 100%; font-size: 13px; }

  /* Panel / formularios */
  .panel { padding: 0.875rem; }
  .panel-title { font-size: 13px; }
  .field-input, .field-select, .field-textarea { font-size: 16px; } /* Evita zoom en iOS */

  /* Botones */
  .btn-primary, .btn-secondary { font-size: 13px; padding: 8px 12px; }
  .form-actions { flex-wrap: wrap; gap: 8px; }
  .form-actions button { flex: 1; min-width: 100px; }

  /* Topbar */
  #add-btn { padding: 7px 10px; }
  #add-btn-text { display: none; } /* Solo icono en móvil */
  #add-btn-icon { margin: 0; }

  /* Detalle grid */
  .detalle-grid { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Cotización detalle */
  .cot-preview-header { flex-direction: column; gap: 0.75rem; }
  .cot-folio-info { text-align: left; }

  /* Chat */
  .chat-panel { 
    width: calc(100vw - 1rem); 
    right: 0.5rem; 
    bottom: 4.5rem;
    max-height: 70vh;
  }
  .chat-btn { bottom: 1rem; right: 1rem; }

  /* Ficha técnica modal */
  .ficha-card { max-height: 95vh; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .ficha-modal { align-items: flex-end; padding: 0; }
  .ficha-row { flex-direction: column; gap: 0.5rem; }
  .ficha-campo { min-width: unset; width: 100%; }

  /* Tags más pequeños */
  .tag { font-size: 10px; padding: 2px 6px; }

  /* Dashboard actividad */
  .dash-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .activity-item { flex-wrap: wrap; gap: 4px; }

  /* Sidebar brand */
  .sidebar-brand { padding: 1rem; }
}

@media (max-width: 380px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .page-content { padding: 0.5rem; }
  .stage-column { min-width: 220px; }
}

/* ── DRAG & DROP PIPELINE ── */
.kanban-card[draggable="true"] { cursor: grab; transition: opacity 0.15s, box-shadow 0.15s; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.stage-column.drag-over { background: rgba(245, 200, 0, 0.08); border: 2px dashed var(--yellow); border-radius: var(--radius); }

/* ── DETALLE PROSPECTO: MODO LECTURA / EDICIÓN ── */
.detalle-readonly .field-input,
.detalle-readonly .field-select,
.detalle-readonly .field-textarea {
  background: transparent !important;
  border-color: transparent !important;
  pointer-events: none;
  color: var(--black);
  padding-left: 0;
}
.detalle-readonly .field-label { color: var(--gray-500); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.detalle-edit-bar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }

/* ── MÚLTIPLES CONTACTOS ── */
.contacto-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.contacto-item:last-child { border-bottom: none; }
.contacto-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--black); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.contacto-info { flex: 1; min-width: 0; }
.contacto-nombre { font-size: 13px; font-weight: 600; }
.contacto-cargo { font-size: 11px; color: var(--gray-500); margin-bottom: 2px; }
.contacto-datos { font-size: 11px; color: var(--gray-700); }

/* ── FICHA TÉCNICA INVENTARIO/CATÁLOGO ── */
.ficha-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ficha-card { background: white; border-radius: var(--radius); max-width: 680px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.ficha-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid rgba(0,0,0,0.08); }
.ficha-body { padding: 1.25rem; }
.ficha-foto { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--radius-sm); background: var(--gray-100); margin-bottom: 1rem; }
.ficha-row { display: flex; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.ficha-campo { flex: 1; min-width: 140px; }
.ficha-campo-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--gray-500); margin-bottom: 2px; }
.ficha-campo-valor { font-size: 13px; font-weight: 500; }

/* ── ADJUNTOS EN COTIZACIONES ── */
.adjunto-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--gray-100); border-radius: var(--radius-sm); margin-bottom: 6px; }
.adjunto-icon { width: 28px; height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.adjunto-icon.pdf { background: #FEE2E2; color: #DC2626; }
.adjunto-icon.img { background: #DBEAFE; color: #2563EB; }
.adjunto-nombre { flex: 1; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── VALORES READ-ONLY EN DETALLE ── */
.ro-val { font-size: 13px; font-weight: 500; padding: 4px 0; min-height: 22px; }

/* ── CHAT: badge de no leídos por usuario ── */
.chat-unread-dot {
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--yellow); color: var(--black);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; flex-shrink: 0;
}

/* ── PRINT: ocultar UI, mantener cotización legible ── */
@media print {
  .no-print, .form-actions, .btn-danger,
  .btn-secondary, .btn-primary, .topbar, .sidebar,
  .chat-btn, .chat-panel, .toast, #ficha-modal,
  .view-filters, .sidebar-overlay { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .page-content { padding: 0 !important; }
  .panel { box-shadow: none !important; border: none !important; max-width: 100% !important; border-radius: 0 !important; }
  body { font-size: 11px; }
  .cot-preview-header { border-bottom: 2px solid #000; margin-bottom: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .total-row { font-size: 14px; }
}

/* ── EDITOR DE ESPECIFICACIONES TÉCNICAS (v10) ── */
.specs-section-block { transition: border-color 0.2s; }
.specs-section-block:hover { border-color: var(--accent, #F5C800) !important; }

/* ── NOTIFICACIONES IN-APP ── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.notif-wrapper { position: relative; }
.btn-bell {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: background 0.15s;
}
.btn-bell:hover { background: var(--gray-100); }
.btn-bell svg { width: 20px; height: 20px; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--gray-100);
}
.notif-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
}
.notif-mark-all {
  font-size: 11px;
  color: var(--gray-500);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.notif-mark-all:hover { color: var(--gray-700); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-group-label {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-icon.hoy { background: #FEF9E7; }
.notif-icon.vencido { background: #FEE2E2; }
.notif-body { flex: 1; min-width: 0; }
.notif-empresa { font-size: 13px; font-weight: 600; color: var(--black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-detalle { font-size: 11px; color: var(--gray-500); margin-top: 1px; }
.notif-detalle.urgente { color: var(--danger); font-weight: 600; }
.notif-empty { padding: 24px 14px; text-align: center; color: var(--gray-500); font-size: 13px; }

/* ── UBICACIÓN EN VISITAS ── */
.log-ubicacion { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:#065F46; background:#D1FAE5; border-radius:4px; padding:3px 8px; margin-top:5px; text-decoration:none; font-weight:600; }
.log-ubicacion:hover { background:#A7F3D0; }
.log-sin-ubicacion { display:inline-flex; align-items:center; gap:4px; font-size:11px; color:var(--gray-400); background:var(--gray-100); border-radius:4px; padding:3px 8px; margin-top:5px; }
.log-ubic-block { margin-bottom:8px; }
.log-ubic-status { margin-top:6px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.log-ubic-capturada { display:inline-flex; align-items:center; gap:5px; font-size:12px; color:#065F46; background:#D1FAE5; border-radius:4px; padding:4px 10px; font-weight:600; max-width:100%; word-break:break-word; }

/* ── Visor Bot WhatsApp ── */
.wa-fecha{margin-left:auto;font-size:11px;color:var(--gray-400);flex-shrink:0}
.wa-preview{color:var(--gray-500);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wa-thread-head{display:flex;justify-content:flex-end;margin-bottom:10px}
.wa-thread{background:var(--gray-50);border:1px solid var(--gray-200);border-radius:12px;padding:16px;max-height:calc(100vh - 230px);overflow-y:auto;display:flex;flex-direction:column;gap:6px}
.wa-day{align-self:center;font-size:11px;color:var(--gray-500);background:var(--gray-100);border-radius:10px;padding:2px 10px;margin:8px 0 4px}
.wa-bubble{max-width:75%;padding:8px 12px;border-radius:10px;font-size:13.5px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.wa-cliente{align-self:flex-start;background:#FFFFFF;border:1px solid var(--gray-200)}
.wa-bot{align-self:flex-end;background:#FFF8D6;border:1px solid var(--primary-dark)}
.wa-hora{display:block;font-size:10px;color:var(--gray-400);text-align:right;margin-top:3px}
@media (max-width:640px){.wa-bubble{max-width:88%}}
