:root{
  --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card: #ffffff;
  --surface: #f8fafc;
  --line: rgba(15, 23, 42, 0.12);
  --txt: #0f172a;
  --muted: #64748b;
  --acc: #10b981;
  --acc2: #667eea;
  --acc3: #f43f5e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,0.10);
  --radius: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
*{box-sizing:border-box}
body{
  margin:0;
  background: var(--bg);
  min-height: 100vh;
  padding: 16px;
  color: var(--txt);
}

.cv-wrap{
  width:min(96vw, 2200px);
  margin:0 auto;
  min-height: calc(100vh - 32px);
  display:flex;
  flex-direction:column;
}
.cv-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.cv-brand{display:flex;gap:12px;align-items:center}
.cv-dot{width:12px;height:12px;border-radius:999px;background:var(--acc);box-shadow:0 0 0 6px rgba(16,185,129,.12)}
.cv-title{font-weight:800;font-size:18px;letter-spacing:.2px}
.cv-sub{color:var(--muted);font-size:12px;margin-top:2px}
.cv-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.is-hidden{display:none !important}

.cv-modebar{
  margin-top:12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) padding-box,
    linear-gradient(120deg, rgba(16,185,129,.55), rgba(102,126,234,.55), rgba(244,63,94,.35), rgba(16,185,129,.55)) border-box;
  background-size: 100% 100%, 220% 220%;
}
.cv-mode-tabs{display:flex;gap:8px;flex-wrap:wrap}
.cv-mode-tabs .pill{font-size:13px;padding:8px 12px}

.btn{
  appearance:none;
  border:2px solid #e5e7eb;
  background:#ffffff;
  color:var(--txt);
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.btn:hover{border-color:rgba(102,126,234,.55);box-shadow:0 0 0 3px rgba(102,126,234,.15);transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn-ghost{background:transparent}
.btn-danger{border-color:rgba(239,68,68,.35);color:#991b1b}
.btn-danger:hover{border-color:rgba(239,68,68,.75);box-shadow:0 0 0 3px rgba(239,68,68,.12)}

.cv-main{
  display:grid;
  grid-template-columns: 360px 1fr 340px;
  gap:20px;
  margin-top:20px;
  flex:1;
  min-height:0;
}
.cv-left,.cv-center,.cv-right{min-height:0}

.cv-table-view{
  margin-top:20px;
  background: var(--card);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) padding-box,
    linear-gradient(120deg, rgba(16,185,129,.55), rgba(102,126,234,.55), rgba(244,63,94,.35), rgba(16,185,129,.55)) border-box;
  background-size: 100% 100%, 220% 220%;
  padding: 18px;
}
.cv-table-head{margin-bottom:10px}
.cv-table-title{font-weight:900;font-size:18px}
.cv-table-sub{color:var(--muted);font-size:12px;margin-top:4px}

.cv-table-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-top:10px;
}
.cv-table-kpi{
  border:1.5px solid rgba(99,102,241,.24);
  background:linear-gradient(180deg, rgba(238,242,255,.96), rgba(255,255,255,.98));
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow:0 10px 24px rgba(99,102,241,.08);
}

.cv-table-filters{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:10px;
}
.cv-table-filters .f{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.cv-table-filters label{
  font-size:11px;
  color:var(--muted);
  font-weight:800;
  letter-spacing:.2px;
}
.cv-table-filters input,
.cv-table-filters select{
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:2px solid #e5e7eb;
  background:#fff;
  outline:none;
}
.cv-table-filters input:focus,
.cv-table-filters select:focus{
  border-color:rgba(102,126,234,.55);
  box-shadow:0 0 0 3px rgba(102,126,234,.15);
}
.cv-filter-actions{
  justify-content:flex-end;
  align-self:flex-end;
  gap:8px;
}
.cv-filter-actions .btn{width:100%}

.cv-table-wrap{
  margin-top:12px;
  border:1px solid rgba(15,23,42,.12);
  border-radius:14px;
  overflow:auto;
  background:#fff;
}
.cv-grid-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:1780px;
}
.cv-grid-table thead th{
  position:sticky;
  top:0;
  z-index:2;
  background:#0f172a;
  color:#e2e8f0;
  font-size:12px;
  letter-spacing:.2px;
  text-align:left;
  padding:10px 12px;
  border-bottom:1px solid rgba(15,23,42,.12);
}
.cv-th-sort{
  appearance:none;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  font-weight:900;
  font-size:12px;
  letter-spacing:.2px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:0;
}
.cv-th-sort .m{
  display:inline-flex;
  min-width:22px;
  justify-content:center;
  font-size:10px;
  line-height:1;
  color:#93c5fd;
}
.cv-th-sort.active .m{color:#fef08a}
.cv-grid-table tbody td{
  padding:10px 12px;
  border-bottom:1px solid rgba(15,23,42,.08);
  vertical-align:top;
  font-size:13px;
}
.cv-grid-table tbody tr:hover{background:rgba(102,126,234,.08)}
.cv-grid-table tbody tr.cv-row-tone-f{background:linear-gradient(180deg, rgba(253,242,248,.88), rgba(255,255,255,.98))}
.cv-grid-table tbody tr.cv-row-tone-f:hover{background:linear-gradient(180deg, rgba(252,231,243,.96), rgba(255,255,255,.98))}
.cv-grid-table tbody tr.cv-row-tone-m{background:linear-gradient(180deg, rgba(239,246,255,.92), rgba(255,255,255,.98))}
.cv-grid-table tbody tr.cv-row-tone-m:hover{background:linear-gradient(180deg, rgba(219,234,254,.96), rgba(255,255,255,.98))}
.cv-row-main{font-weight:800}
.cv-row-sub{font-size:12px;color:var(--muted);margin-top:4px}
.cv-badge-f{
  border-color:rgba(236,72,153,.34);
  background:rgba(244,114,182,.14);
  color:#9d174d;
}
.cv-badge-m{
  border-color:rgba(59,130,246,.34);
  background:rgba(96,165,250,.14);
  color:#1d4ed8;
}
.cv-actions-inline{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.cv-actions-inline .badge{
  cursor:pointer;
  text-decoration:none;
}
.cv-hover{
  position:relative;
  cursor:help;
  border-bottom:1px dashed rgba(15,23,42,.35);
}
.cv-hover::after{
  content: attr(data-tip);
  position:absolute;
  left:0;
  bottom:calc(100% + 8px);
  min-width:260px;
  max-width:420px;
  background:rgba(15,23,42,.97);
  color:#e2e8f0;
  border:1px solid rgba(148,163,184,.35);
  border-radius:10px;
  padding:8px 10px;
  font-size:11px;
  line-height:1.45;
  white-space:pre-line;
  opacity:0;
  transform:translateY(4px);
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  z-index:20;
  box-shadow:0 10px 28px rgba(0,0,0,.45);
}
.cv-hover:hover::after{
  opacity:1;
  transform:translateY(0);
}

.cv-left,.cv-center,.cv-right{
  position: relative;
  border-radius: calc(var(--radius) + 2px);
}

/* Igualar alturas de columnas (desktop) */
@media (min-width: 1101px){
  .cv-main{height: calc(100vh - 140px);}
  .cv-left,.cv-center,.cv-right{height: 100%;}
  .cv-left{display:flex;flex-direction:column;overflow:hidden}
  .cv-left .cv-search{flex:0}
  .cv-left .cv-results{flex:1;max-height:none}
  .cv-center{display:flex;min-height:0}
  .cv-right{overflow:auto;padding-right:2px}
  .cv-detail{height:100%;flex:1;min-height:0}
}

.cv-search,
.cv-results,
.cv-detail,
.cv-card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Borde premium (sutil, animación en hover/focus) */
.cv-search,
.cv-results,
.cv-detail,
.cv-card,
.cv-top{
  border: 1.5px solid transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) padding-box,
    linear-gradient(120deg, rgba(16,185,129,.55), rgba(102,126,234,.55), rgba(244,63,94,.35), rgba(16,185,129,.55)) border-box;
  background-size: 100% 100%, 220% 220%;
  background-position: 0 0, 0% 50%;
}
@keyframes cv-border-shift{
  0%{background-position: 0 0, 0% 50%}
  50%{background-position: 0 0, 100% 50%}
  100%{background-position: 0 0, 0% 50%}
}
.cv-search:hover,
.cv-results:hover,
.cv-detail:hover,
.cv-card:hover,
.cv-top:hover,
.cv-search:focus-within,
.cv-detail:focus-within,
.cv-card:focus-within,
.cv-top:focus-within{
  animation: cv-border-shift 10s ease-in-out infinite;
  box-shadow: 0 14px 38px rgba(0,0,0,0.14);
}
@media (prefers-reduced-motion: reduce){
  .cv-search:hover,
  .cv-results:hover,
  .cv-detail:hover,
  .cv-card:hover,
  .cv-top:hover,
  .cv-search:focus-within,
  .cv-detail:focus-within,
  .cv-card:focus-within,
  .cv-top:focus-within{
    animation: none;
  }
}
.cv-search{padding:14px}
.cv-card .cv-results{
  box-shadow:none;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 12px;
}
#q{
  width:100%;
  padding:12px 14px;
  border-radius:10px;
  border:2px solid #e5e7eb;
  outline:none;
  background:#ffffff;
  color:var(--txt);
}
#q:focus{border-color:rgba(16,185,129,.55);box-shadow:0 0 0 3px rgba(16,185,129,.14)}
.cv-hint{margin-top:8px;color:var(--muted);font-size:12px}

.cv-results{
  margin-top:12px;
  overflow:auto;
  max-height: calc(74vh - 140px);
}
.item{
  padding:12px 14px;
  border-bottom:1px solid rgba(15,23,42,.08);
  cursor:pointer;
  position: relative;
}
.item:hover{background: var(--surface)}
.item .name{font-weight:800}
.meta{color:var(--muted);font-size:12px;margin-top:4px}
.item .meta{color:var(--muted);font-size:12px;margin-top:4px;display:flex;gap:10px;flex-wrap:wrap}

.badge{
  border:1px solid rgba(15,23,42,.12);
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  color:rgba(15,23,42,.82);
  text-decoration:none;
  background: rgba(255,255,255,.7);
}
.badge.ok{border-color:rgba(16,185,129,.35);background:rgba(16,185,129,.10);color:#065f46}
.badge.warn{border-color:rgba(239,68,68,.25);background:rgba(239,68,68,.10);color:#991b1b}

/* Colores por pipeline en lista de clientes */
.badge.badge-pipe{font-weight:900}
.badge.badge-pipe-lead,
.badge.badge-pipe-nuevo{border-color:rgba(99,102,241,.28);background:rgba(99,102,241,.10);color:rgba(55,48,163,.95)}
.badge.badge-pipe-interesado{border-color:rgba(14,165,233,.28);background:rgba(14,165,233,.12);color:rgba(12,74,110,.95)}
.badge.badge-pipe-agendado{border-color:rgba(245,158,11,.28);background:rgba(245,158,11,.12);color:rgba(146,64,14,.95)}
.badge.badge-pipe-escaneado{border-color:rgba(16,185,129,.32);background:rgba(16,185,129,.12);color:rgba(6,95,70,.95)}
.badge.badge-pipe-cliente,
.badge.badge-pipe-vendido,
.badge.badge-pipe-recompra{border-color:rgba(34,197,94,.30);background:rgba(34,197,94,.12);color:rgba(21,128,61,.95)}
.badge.badge-pipe-perdido,
.badge.badge-pipe-no_asistio{border-color:rgba(239,68,68,.30);background:rgba(239,68,68,.12);color:rgba(153,27,27,.95)}

.item[class*="pipe-"]{
  border-left: 4px solid rgba(15,23,42,.08);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}
.item.pipe-lead,
.item.pipe-nuevo{border-left-color: rgba(99,102,241,.55)}
.item.pipe-interesado{border-left-color: rgba(14,165,233,.60)}
.item.pipe-agendado{border-left-color: rgba(245,158,11,.60)}
.item.pipe-escaneado{border-left-color: rgba(16,185,129,.65)}
.item.pipe-cliente,
.item.pipe-vendido,
.item.pipe-recompra{border-left-color: rgba(34,197,94,.70)}
.item.pipe-perdido,
.item.pipe-no_asistio{border-left-color: rgba(239,68,68,.65)}

.item.pipe-vendido .name,
.item.pipe-recompra .name{letter-spacing:.15px}

.cv-detail{
  padding:18px;
  height:74vh;
  overflow:auto;
}
.cv-detail.empty{display:flex;align-items:center;justify-content:center}
.cv-empty-title{font-size:18px;font-weight:900}
.cv-empty-sub{color:var(--muted);margin-top:6px}
.row{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.k{color:var(--muted);font-size:12px}
.v{font-weight:800}

.cv-sec{
  margin-top:14px;
  padding:14px;
  border:1px solid rgba(15,23,42,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.92));
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}

.cv-map-view{margin-top:14px}
.cv-map-shell{
  display:grid;
  grid-template-columns:minmax(0,1.5fr) minmax(320px,.8fr);
  gap:14px;
}
.cv-map-canvas{
  min-height:520px;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(15,23,42,.10);
  background:#dbeafe;
}
.cv-map-side{
  border:1px solid rgba(15,23,42,.10);
  border-radius:16px;
  background:linear-gradient(180deg,#fff,#f8fafc);
  padding:14px;
  display:flex;
  flex-direction:column;
  min-height:520px;
}
.cv-map-side-head{margin-bottom:10px}
.cv-map-side-title{font-size:18px;font-weight:900}
.cv-map-side-sub{color:var(--muted);font-size:12px;margin-top:4px}
.cv-map-stats{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.cv-map-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
  min-height:0;
}
.cv-map-item{
  appearance:none;
  width:100%;
  text-align:left;
  border:1px solid rgba(15,23,42,.10);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}
.cv-map-item:hover{background:#eff6ff;border-color:rgba(59,130,246,.35)}
.cv-map-item-name{font-weight:800}
.cv-map-item-meta{font-size:12px;color:var(--muted);margin-top:3px}
.cv-map-empty{padding:16px;border:1px dashed rgba(15,23,42,.18);border-radius:14px;color:var(--muted);font-size:13px}
.cv-map-popup-name{font-weight:800}
.cv-map-popup-meta{font-size:12px;color:#334155;margin-top:3px}

.cv-ra-workspace{
  margin-top:14px;
  border:1px solid rgba(15,23,42,.12);
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff,#f8fafc);
  padding:16px;
}
.cv-ra-workspace-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.cv-ra-workspace-title{font-size:22px;font-weight:900}
.cv-ra-workspace-sub{font-size:13px;color:var(--muted);margin-top:4px}
.cv-ra-workspace-actions{display:flex;gap:8px;flex-wrap:wrap}
.cv-workspace-empty{
  padding:26px;
  border:1px dashed rgba(15,23,42,.18);
  border-radius:16px;
  background:rgba(248,250,252,.85);
}
.cv-ra-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}
.cv-ra-card{
  border:1.5px solid rgba(125,211,252,.22);
  border-radius:16px;
  padding:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,250,252,.96));
  box-shadow:0 12px 28px rgba(15,23,42,.07);
}
.cv-ra-alert{
  border-color:rgba(245,158,11,.28);
  background:linear-gradient(180deg,rgba(255,251,235,.98),#fff);
}
.cv-ra-hero{grid-column:1 / -1}
.cv-ra-hero-top{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.cv-ra-hero-name{font-size:24px;font-weight:900}
.cv-ra-hero-sub{font-size:13px;color:var(--muted);margin-top:4px}
.cv-ra-summary-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:14px;
}
.cv-ra-summary-grid > div{
  border:1px solid rgba(15,23,42,.08);
  border-radius:12px;
  background:#fff;
  padding:10px 12px;
}
.cv-ra-summary-grid .k{
  display:block;
  margin-bottom:4px;
}
.cv-ra-card-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.cv-ra-card-head h3{
  margin:0;
  font-size:16px;
  font-weight:900;
}
.cv-ra-kv{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 0;
  border-bottom:1px dashed rgba(15,23,42,.08);
}
.cv-ra-kv:last-of-type{border-bottom:0}
.cv-ra-kv span{color:var(--muted);font-size:12px}
.cv-ra-kv strong{text-align:right}
.cv-ra-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.cv-ra-list-item{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  border:1px solid rgba(15,23,42,.08);
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
}
.cv-ra-list-title{font-weight:800}
.cv-ra-list-meta{font-size:12px;color:var(--muted);margin-top:4px}
.cv-ra-empty-sm{
  padding:14px;
  border:1px dashed rgba(15,23,42,.18);
  border-radius:12px;
  color:var(--muted);
  font-size:13px;
  background:#fff;
}
.cv-table-stage-kpis{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px;
  margin-top:10px;
}
.cv-stage-kpi{
  border:1.5px solid rgba(15,23,42,.10);
  border-radius:14px;
  padding:12px 14px;
  background:linear-gradient(180deg,#fff,#f8fafc);
  box-shadow:0 12px 24px rgba(15,23,42,.07);
}
.cv-stage-kpi .k{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}
.cv-stage-kpi .v{
  margin-top:6px;
  font-size:28px;
  line-height:1;
  font-weight:900;
}
.cv-stage-kpi.is-lead{border-color:rgba(59,130,246,.38);background:linear-gradient(180deg,rgba(219,234,254,.98),rgba(239,246,255,.98));box-shadow:0 12px 26px rgba(59,130,246,.10)}
.cv-stage-kpi.is-interesado{border-color:rgba(249,115,22,.38);background:linear-gradient(180deg,rgba(255,237,213,.98),rgba(255,247,237,.98));box-shadow:0 12px 26px rgba(249,115,22,.10)}
.cv-stage-kpi.is-agendado{border-color:rgba(245,158,11,.42);background:linear-gradient(180deg,rgba(254,240,138,.28),rgba(254,252,232,.98));box-shadow:0 12px 26px rgba(245,158,11,.10)}
.cv-stage-kpi.is-escaneado{border-color:rgba(20,184,166,.40);background:linear-gradient(180deg,rgba(204,251,241,.98),rgba(240,253,250,.98));box-shadow:0 12px 26px rgba(20,184,166,.10)}
.cv-stage-kpi.is-cliente{border-color:rgba(16,185,129,.42);background:linear-gradient(180deg,rgba(209,250,229,.98),rgba(236,253,245,.98));box-shadow:0 12px 26px rgba(16,185,129,.10)}
.cv-stage-kpi.is-perdido{border-color:rgba(239,68,68,.38);background:linear-gradient(180deg,rgba(254,226,226,.98),rgba(254,242,242,.98));box-shadow:0 12px 26px rgba(239,68,68,.10)}
.cv-cell-open{
  display:block;
  width:100%;
  border:0;
  padding:0;
  background:transparent;
  text-align:left;
  cursor:pointer;
}
.cv-cell-open:hover .cv-row-main{
  color:#2563eb;
  text-decoration:underline;
  text-decoration-thickness:2px;
}

@media (max-width: 1100px){
  .cv-map-shell{grid-template-columns:1fr}
  .cv-ra-grid{grid-template-columns:1fr 1fr}
  .cv-ra-summary-grid{grid-template-columns:1fr 1fr}
  .cv-table-stage-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
}

@media (max-width: 760px){
  .cv-ra-grid,
  .cv-ra-summary-grid{grid-template-columns:1fr}
  .cv-ra-list-item,
  .cv-ra-kv{flex-direction:column;align-items:flex-start}
  .cv-table-stage-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
}
.cv-sec::before{
  content:"";
  position:absolute;
  left:0; top:0; bottom:0;
  width: 4px;
  background: linear-gradient(180deg, rgba(16,185,129,.85), rgba(102,126,234,.65));
}
.cv-sec-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding-left: 8px;
}
.cv-sec-title{font-weight:900}
.cv-sec-sub{color:var(--muted);font-size:12px;margin-top:4px}

.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
a.action{
  text-decoration:none;
  border:2px solid #e5e7eb;
  padding:8px 10px;
  border-radius:10px;
  color:var(--txt);
  background:#ffffff;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  gap:8px;
  line-height:1;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
a.action:hover{border-color:rgba(102,126,234,.55);box-shadow:0 0 0 3px rgba(102,126,234,.15);transform:translateY(-1px)}
a.action:active{transform:translateY(0)}
a.action.danger{border-color:rgba(239,68,68,.30);color:#991b1b}
a.action.danger:hover{border-color:rgba(239,68,68,.75);box-shadow:0 0 0 3px rgba(239,68,68,.12)}

.cv-card{padding:14px}
.cv-card-title{font-weight:900}
.cv-kpis{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
  margin-top:10px;
}
.cv-kpi{
  border:1.5px solid rgba(16,185,129,.20);
  background: linear-gradient(180deg, rgba(236,253,245,.98), rgba(255,255,255,.98));
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow:0 10px 22px rgba(16,185,129,.08);
}
.cv-pillrow{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.cv-detail .cv-pillrow{
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 10px;
  margin: 0;
  margin-top: 12px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.06);
  backdrop-filter: blur(10px);
}
.pill{
  appearance:none;
  border:2px solid #e5e7eb;
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  background:#ffffff;
  color: var(--txt);
  cursor:pointer;
  font-weight:800;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.pill{ text-decoration:none; display:inline-flex; align-items:center; }
.pill:hover{border-color:rgba(102,126,234,.55);box-shadow:0 0 0 3px rgba(102,126,234,.15)}
.pill.active{border-color:rgba(16,185,129,.55);background: rgba(16,185,129,.10);box-shadow:0 0 0 3px rgba(16,185,129,.14)}
.cv-note{color:var(--muted);font-size:12px;margin-top:12px;line-height:1.4}

.item.active{background: rgba(102,126,234,.10)}
.item.active .name{color: rgba(102,126,234,.95)}
.item.active .badge.ok{
  border-color: rgba(102,126,234,.35);
  background: rgba(102,126,234,.10);
  color: rgba(30,64,175,.92);
}

.cv-client-name{
  font-weight: 950;
  font-size: 22px;
  letter-spacing: .2px;
  background: linear-gradient(90deg, rgba(16,185,129,.95), rgba(102,126,234,.95));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cv-detail input,
.cv-detail select,
.cv-detail textarea,
.modal-card input,
.modal-card select,
.modal-card textarea{
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:2px solid #e5e7eb;
  outline:none;
  background:#ffffff;
  color:var(--txt);
}
.cv-detail input:focus,
.cv-detail select:focus,
.cv-detail textarea:focus,
.modal-card input:focus,
.modal-card select:focus,
.modal-card textarea:focus{
  border-color:rgba(102,126,234,.55);
  box-shadow:0 0 0 3px rgba(102,126,234,.15);
}

/* modal */
.modal{position:fixed;inset:0;background:rgba(15,23,42,.55);display:flex;align-items:flex-start;justify-content:center;padding:16px;overflow:auto;isolation:isolate}
.modal.hidden{display:none}
.modal-card{
  width:min(980px, 96vw);
  max-height:min(96vh, 1280px);
  height:min(96vh, 1280px);
  margin:auto 0;
  display:flex;
  flex-direction:column;
  border:1px solid rgba(15,23,42,.10);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2147483601;
}
.modal{z-index:2147483600}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--line);flex:0 0 auto}
.modal-title{font-weight:900}
.x{background:transparent;border:0;color:rgba(15,23,42,.75);cursor:pointer;font-size:16px}
.modal-body{padding:14px;color:var(--txt);overflow:auto;overscroll-behavior:contain;position:relative;z-index:1;flex:1 1 auto;min-height:0}
.modal-foot{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding:12px 14px;
  border-top:1px solid var(--line);
  flex:0 0 auto;
  position:sticky;
  bottom:0;
  background:linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.99));
  backdrop-filter:blur(8px);
  z-index:2;
}
html.cv-modal-open,body.cv-modal-open{overflow:hidden}
.modal.cv-modal-wide .modal-card{width:min(1280px, 96vw)}
.modal.cv-client-modal .modal-card{
  --cv-modal-accent: rgba(236,72,153,.72);
  --cv-modal-accent-soft: rgba(244,114,182,.16);
  --cv-modal-accent-strong: rgba(236,72,153,.84);
  --cv-modal-frame: rgba(236,72,153,.22);
  border:1px solid rgba(255,255,255,.25);
  border-radius:20px;
  box-shadow:0 30px 80px rgba(15,23,42,.28), 0 8px 24px rgba(236,72,153,.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.99)) padding-box,
    linear-gradient(135deg, var(--cv-modal-accent), rgba(102,126,234,.58), rgba(16,185,129,.36), rgba(245,158,11,.34)) border-box;
}
.modal.cv-client-modal .modal-head{
  background:linear-gradient(135deg, rgba(255,255,255,.96), rgba(249,250,251,.90), var(--cv-modal-accent-soft));
  border-bottom:1px solid var(--cv-modal-frame);
}
.modal.cv-client-modal .modal-title{
  font-size:15px;
  letter-spacing:.2px;
}
.modal.cv-client-modal .modal-body{
  background:
    radial-gradient(circle at top right, var(--cv-modal-accent-soft), transparent 34%),
    radial-gradient(circle at left center, rgba(102,126,234,.08), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
}
.modal.cv-client-modal .modal-foot{
  border-top:1px solid var(--cv-modal-frame);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.98)) padding-box,
    linear-gradient(135deg, rgba(255,255,255,.60), var(--cv-modal-accent-soft), rgba(102,126,234,.10)) border-box;
}
.modal.cv-client-modal .modal-card input:not([type="checkbox"]):not([type="hidden"]),
.modal.cv-client-modal .modal-card select,
.modal.cv-client-modal .modal-card textarea{
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
  border-color:rgba(148,163,184,.28);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95);
  transition:border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease;
}
.modal.cv-client-modal .modal-card input:not([type="checkbox"]):not([type="hidden"]):focus,
.modal.cv-client-modal .modal-card select:focus,
.modal.cv-client-modal .modal-card textarea:focus{
  transform:translateY(-1px);
}
.modal.cv-client-modal.cv-gender-theme-f .modal-card input:not([type="checkbox"]):not([type="hidden"]),
.modal.cv-client-modal.cv-gender-theme-f .modal-card select,
.modal.cv-client-modal.cv-gender-theme-f .modal-card textarea{
  border-color:rgba(244,114,182,.35);
}
.modal.cv-client-modal.cv-gender-theme-f .modal-card{
  --cv-modal-accent: rgba(236,72,153,.84);
  --cv-modal-accent-soft: rgba(244,114,182,.20);
  --cv-modal-accent-strong: rgba(236,72,153,.92);
  --cv-modal-frame: rgba(244,114,182,.28);
}
.modal.cv-client-modal.cv-gender-theme-f .modal-card input:not([type="checkbox"]):not([type="hidden"]):focus,
.modal.cv-client-modal.cv-gender-theme-f .modal-card select:focus,
.modal.cv-client-modal.cv-gender-theme-f .modal-card textarea:focus{
  border-color:rgba(236,72,153,.75);
  box-shadow:0 0 0 4px rgba(244,114,182,.15), inset 0 1px 0 rgba(255,255,255,.9);
}
.modal.cv-client-modal.cv-gender-theme-m .modal-card input:not([type="checkbox"]):not([type="hidden"]),
.modal.cv-client-modal.cv-gender-theme-m .modal-card select,
.modal.cv-client-modal.cv-gender-theme-m .modal-card textarea{
  border-color:rgba(96,165,250,.38);
}
.modal.cv-client-modal.cv-gender-theme-m .modal-card{
  --cv-modal-accent: rgba(59,130,246,.84);
  --cv-modal-accent-soft: rgba(96,165,250,.20);
  --cv-modal-accent-strong: rgba(37,99,235,.92);
  --cv-modal-frame: rgba(96,165,250,.28);
  box-shadow:0 30px 80px rgba(15,23,42,.28), 0 8px 24px rgba(59,130,246,.14);
}
.modal.cv-client-modal.cv-gender-theme-m .modal-card input:not([type="checkbox"]):not([type="hidden"]):focus,
.modal.cv-client-modal.cv-gender-theme-m .modal-card select:focus,
.modal.cv-client-modal.cv-gender-theme-m .modal-card textarea:focus{
  border-color:rgba(59,130,246,.8);
  box-shadow:0 0 0 4px rgba(96,165,250,.16), inset 0 1px 0 rgba(255,255,255,.9);
}
.modal.cv-client-modal.cv-gender-theme-o .modal-card input:not([type="checkbox"]):not([type="hidden"]),
.modal.cv-client-modal.cv-gender-theme-o .modal-card select,
.modal.cv-client-modal.cv-gender-theme-o .modal-card textarea{
  border-color:rgba(168,85,247,.35);
}
.modal.cv-client-modal.cv-gender-theme-o .modal-card{
  --cv-modal-accent: rgba(139,92,246,.82);
  --cv-modal-accent-soft: rgba(168,85,247,.18);
  --cv-modal-accent-strong: rgba(124,58,237,.90);
  --cv-modal-frame: rgba(168,85,247,.26);
}
.modal.cv-client-modal.cv-gender-theme-o .modal-card input:not([type="checkbox"]):not([type="hidden"]):focus,
.modal.cv-client-modal.cv-gender-theme-o .modal-card select:focus,
.modal.cv-client-modal.cv-gender-theme-o .modal-card textarea:focus{
  border-color:rgba(139,92,246,.78);
  box-shadow:0 0 0 4px rgba(168,85,247,.14), inset 0 1px 0 rgba(255,255,255,.9);
}
.cv-form-section{
  margin-top:14px;
  padding:14px;
  border:1.5px solid var(--cv-section-frame, rgba(148,163,184,.22));
  border-radius:16px;
  background:linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,250,252,.96), var(--cv-section-tint, rgba(244,114,182,.04)));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95), 0 10px 26px rgba(15,23,42,.06), 0 0 0 1px rgba(255,255,255,.65);
  position:relative;
}
.cv-form-section::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:4px;
  border-radius:16px 0 0 16px;
  background:linear-gradient(180deg, rgba(236,72,153,.8), rgba(102,126,234,.8));
}
.modal.cv-client-modal.cv-gender-theme-f .cv-form-section{
  --cv-section-frame: rgba(244,114,182,.26);
  --cv-section-tint: rgba(251,207,232,.20);
}
.modal.cv-client-modal.cv-gender-theme-m .cv-form-section{
  --cv-section-frame: rgba(96,165,250,.26);
  --cv-section-tint: rgba(191,219,254,.20);
}
.modal.cv-client-modal.cv-gender-theme-o .cv-form-section{
  --cv-section-frame: rgba(168,85,247,.24);
  --cv-section-tint: rgba(221,214,254,.18);
}
.cv-sec-op{border-color:rgba(16,185,129,.24)}
.cv-sec-client{border-color:rgba(244,114,182,.24)}
.cv-sec-metrics{border-color:rgba(59,130,246,.24)}
.cv-sec-origin{border-color:rgba(245,158,11,.28)}
.cv-sec-dir{border-color:rgba(139,92,246,.24)}
.cv-sec-access{border-color:rgba(6,182,212,.24)}
.cv-sec-diet{border-color:rgba(20,184,166,.24)}
.cv-sec-exp{border-color:rgba(249,115,22,.24)}
.cv-sec-scan{border-color:rgba(99,102,241,.24)}
.cv-form-section__head{margin-bottom:10px}
.cv-form-section__title{
  font-weight:900;
  font-size:15px;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  gap:8px;
}
.cv-form-section__sub{
  color:var(--muted);
  font-size:12px;
  margin-top:4px;
  line-height:1.45;
}
.cv-sec-op::before{background:linear-gradient(180deg,#10b981,#34d399)}
.cv-sec-client::before{background:linear-gradient(180deg,#ec4899,#f472b6)}
.cv-sec-metrics::before{background:linear-gradient(180deg,#3b82f6,#60a5fa)}
.cv-sec-origin::before{background:linear-gradient(180deg,#f59e0b,#fbbf24)}
.cv-sec-dir::before{background:linear-gradient(180deg,#8b5cf6,#a78bfa)}
.cv-sec-access::before{background:linear-gradient(180deg,#06b6d4,#38bdf8)}
.cv-sec-diet::before{background:linear-gradient(180deg,#14b8a6,#2dd4bf)}
.cv-sec-exp::before{background:linear-gradient(180deg,#f97316,#fb923c)}
.cv-sec-scan::before{background:linear-gradient(180deg,#6366f1,#818cf8)}
.cv-gender{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.cv-gender .gbtn{
  appearance:none;
  border:2px solid #e5e7eb;
  border-radius:14px;
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
  color:var(--txt);
  padding:10px 14px;
  cursor:pointer;
  font-weight:800;
  line-height:1;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition:border-color .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}
.cv-gender .gbtn:hover{
  border-color:rgba(102,126,234,.55);
  box-shadow:0 10px 22px rgba(102,126,234,.12), 0 0 0 3px rgba(102,126,234,.08);
  transform:translateY(-1px);
}
.cv-gender .gbtn.active{
  border-color:rgba(16,185,129,.6);
  background:rgba(16,185,129,.10);
  color:#065f46;
  box-shadow:0 0 0 3px rgba(16,185,129,.12);
}
.cv-gender.cv-gender-pro .gbtn .sym{
  font-size:18px;
  width:22px;
  text-align:center;
}
.modal.cv-client-modal.cv-gender-theme-f .cv-gender .gbtn.active{
  border-color:rgba(236,72,153,.75);
  background:linear-gradient(135deg, rgba(253,242,248,.98), rgba(252,231,243,.92));
  color:#9d174d;
  box-shadow:0 12px 24px rgba(244,114,182,.16), 0 0 0 3px rgba(244,114,182,.12);
}
.modal.cv-client-modal.cv-gender-theme-m .cv-gender .gbtn.active{
  border-color:rgba(59,130,246,.75);
  background:linear-gradient(135deg, rgba(239,246,255,.98), rgba(219,234,254,.92));
  color:#1d4ed8;
  box-shadow:0 12px 24px rgba(96,165,250,.16), 0 0 0 3px rgba(96,165,250,.12);
}
.modal.cv-client-modal.cv-gender-theme-o .cv-gender .gbtn.active{
  border-color:rgba(139,92,246,.75);
  background:linear-gradient(135deg, rgba(245,243,255,.98), rgba(237,233,254,.92));
  color:#6d28d9;
  box-shadow:0 12px 24px rgba(168,85,247,.16), 0 0 0 3px rgba(168,85,247,.12);
}
.modal.cv-client-modal .k{
  color:#64748b;
  font-size:11px;
  font-weight:900;
  letter-spacing:.28px;
  text-transform:uppercase;
}
.modal.cv-client-modal .btn{
  border-radius:12px;
}
.modal.cv-client-modal .btn-ghost{
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
}
.modal.cv-client-modal .btn:hover{
  border-color:var(--cv-modal-accent-strong);
  box-shadow:0 0 0 3px var(--cv-modal-accent-soft);
}
.modal.cv-client-modal.cv-gender-theme-f .btn-ghost:hover{
  border-color:rgba(236,72,153,.55);
  box-shadow:0 0 0 3px rgba(244,114,182,.10);
}
.modal.cv-client-modal.cv-gender-theme-m .btn-ghost:hover{
  border-color:rgba(59,130,246,.55);
  box-shadow:0 0 0 3px rgba(96,165,250,.10);
}
.cv-capture-overlay{
  position:fixed;
  inset:0;
  z-index:2147483647;
  background:rgba(2,6,23,.84);
  backdrop-filter:blur(10px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}
.cv-capture-shell{
  width:min(820px,96vw);
  max-height:92vh;
  overflow:auto;
  background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,250,252,.96));
  border-radius:28px;
  box-shadow:0 30px 100px rgba(2,6,23,.45);
  border:1px solid rgba(148,163,184,.26);
  padding:18px;
}
.cv-capture-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}
.cv-capture-title{
  font-size:22px;
  font-weight:900;
  color:#0f172a;
}
.cv-capture-sub{
  font-size:13px;
  color:#64748b;
  margin-top:4px;
}
.cv-capture-controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}
.cv-capture-stage{
  margin-top:14px;
  border-radius:24px;
  overflow:hidden;
  background:#020617;
  position:relative;
  min-height:320px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06);
}
.cv-capture-stage video{
  display:block;
  width:100%;
  max-height:58vh;
  min-height:320px;
  object-fit:cover;
  background:#020617;
}
.cv-capture-guide{
  position:absolute;
  inset:0;
  pointer-events:none;
}
.cv-capture-guide::before{
  content:"";
  position:absolute;
  inset:0;
  background:rgba(2,6,23,.38);
}
.cv-capture-guide::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  border:2px solid rgba(255,255,255,.96);
  box-shadow:0 0 0 9999px rgba(2,6,23,.30);
}
.cv-capture-guide--face::after{
  width:min(56vw,300px);
  height:min(72vw,380px);
  border-radius:48% 48% 44% 44% / 42% 42% 56% 56%;
}
.cv-capture-guide--eye::after{
  width:min(52vw,280px);
  height:min(30vw,150px);
  border-radius:999px;
}
.cv-capture-guide-line{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  width:min(58vw,320px);
  border-top:1.5px dashed rgba(255,255,255,.88);
}
.cv-capture-guide-line.is-face{top:38%}
.cv-capture-guide-line.is-eye{
  top:50%;
  width:min(56vw,300px);
}
.cv-capture-guide-label{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  top:calc(50% + 170px);
  background:rgba(15,23,42,.72);
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.02em;
  box-shadow:0 12px 30px rgba(2,6,23,.28);
}
.cv-capture-guide--eye .cv-capture-guide-label{top:calc(50% + 92px)}
.cv-capture-hud{
  position:absolute;
  left:14px;
  right:14px;
  bottom:14px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-end;
  pointer-events:none;
}
.cv-capture-status{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.cv-capture-chip{
  background:rgba(15,23,42,.76);
  color:#f8fafc;
  border:1px solid rgba(255,255,255,.12);
  border-radius:999px;
  padding:7px 10px;
  font-size:12px;
  font-weight:800;
  backdrop-filter:blur(8px);
}
.cv-capture-chip.good{background:rgba(5,150,105,.84)}
.cv-capture-chip.warn{background:rgba(217,119,6,.84)}
.cv-capture-chip.bad{background:rgba(220,38,38,.84)}
.cv-capture-tips{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}
.cv-capture-tip{
  border:1px solid rgba(148,163,184,.24);
  border-radius:16px;
  background:#fff;
  padding:12px;
  box-shadow:0 12px 24px rgba(15,23,42,.05);
}
.cv-capture-tip .t{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:#64748b;
  font-weight:900;
}
.cv-capture-tip .v{
  margin-top:6px;
  font-size:13px;
  line-height:1.45;
  color:#0f172a;
  font-weight:700;
}
.cv-capture-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}
.cv-cell-open{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  width:100%;
  text-align:left;
  color:inherit;
  cursor:pointer;
  font:inherit;
}
.cv-cell-open:hover .cv-row-main{
  color:#2563eb;
}

@media (max-width: 1100px){
  body{padding:14px}
  .cv-wrap{
    width:100%;
    min-height: calc(100vh - 28px);
  }
  .cv-main{grid-template-columns: 1fr}
  .cv-left,.cv-center,.cv-right{min-height:auto}
  .cv-detail{height:auto;max-height:none}
  .cv-results{max-height:none}
  .cv-kpis{grid-template-columns: repeat(3, minmax(0, 1fr))}
  .cv-table-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .cv-table-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
  .cv-grid-table{min-width:900px}
}

@media (max-width: 760px){
  body{padding:10px}
  .cv-wrap{
    width:100%;
    min-height: calc(100vh - 20px);
  }
  .modal{padding:10px}
  .modal-card{
    width:min(100vw - 8px, 100%);
    max-height:min(96vh, 1200px);
    border-radius:16px;
  }
  .cv-capture-shell{padding:14px;border-radius:22px}
  .cv-capture-stage video{min-height:280px}
  .cv-capture-tips{grid-template-columns:repeat(2,minmax(0,1fr))}
  .cv-capture-guide--face::after{width:min(66vw,280px);height:min(86vw,360px)}
  .cv-capture-guide--eye::after{width:min(72vw,260px);height:min(38vw,136px)}
  .modal-head,
  .modal-body,
  .modal-foot{
    padding-left:12px;
    padding-right:12px;
  }
  .modal-foot{
    flex-wrap:wrap;
  }
  .modal-foot .btn{
    flex:1 1 160px;
  }
}
