/* PIXAWEB Lead Hunter — identidad «Papel Mineral» (tokens de pixaweb-identidad-2026.css) */
:root {
  --papel: #F4F0E8;
  --papel-2: #ECE6DA;
  --papel-3: #E3DBCC;
  --superficie: #FFFDF9;
  --tinta: #13232B;
  --tinta-2: #1C313B;
  --texto: #22303A;
  --suave: #5B6870;
  --coral: #FF6939;
  --coral-btn: #C8441B;
  --coral-tx: #B23C17;
  --salvia: #2C6E62;
  --salvia-suave: rgba(44, 110, 98, .10);
  --ambar: #8A5A00;
  --linea: rgba(19, 35, 43, .11);
  --linea-2: rgba(19, 35, 43, .2);
  --sombra: 0 1px 2px rgba(19, 35, 43, .06), 0 8px 24px -12px rgba(19, 35, 43, .18);
  --radio: 12px;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--texto);
  font: 15px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
}
a { color: var(--coral-tx); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--tinta); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ── Estructura ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 52px); }
.rail {
  background: var(--tinta);
  color: #E9E4DA;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: grid; gap: 6px; text-decoration: none; padding: 0 8px; }
.brand img { width: 132px; height: auto; }
.brand__app { font: 700 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--coral); }
.nav { display: grid; gap: 2px; }
.nav a {
  color: #CFD6D8; text-decoration: none; padding: 9px 10px; border-radius: 8px;
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--tinta-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--tinta-2); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; background: var(--coral); border-radius: 0 3px 3px 0; }
.rail__foot { margin-top: auto; display: grid; gap: 8px; }
.operator { display: grid; gap: 4px; font-size: 12px; color: #AEB8BB; text-transform: uppercase; letter-spacing: .08em; }
.operator input { background: var(--tinta-2); border: 1px solid #2B4250; color: #fff; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; }
.rail__note { margin: 0; font-size: 12px; color: #8E9A9F; }

main { padding: 28px clamp(16px, 3vw, 40px) 40px; min-width: 0; }
main:focus { outline: none; }

/* ── Tipografía y encabezados ───────────────────────────── */
h1, h2, h3 { font-family: var(--display); color: var(--tinta); letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.1; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
.kicker { font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--salvia); margin: 0 0 8px; }
.lede { color: var(--suave); max-width: 70ch; margin: 8px 0 0; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.muted { color: var(--suave); }
.small { font-size: 13px; }

/* ── Bloques ───────────────────────────────────────────── */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Cifras clave: franja editorial, no tarjetas sueltas */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 2px solid var(--tinta); border-bottom: 1px solid var(--linea-2); margin-bottom: 24px; }
.stat { padding: 14px 14px 16px; border-right: 1px solid var(--linea); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font: 700 32px/1 var(--display); color: var(--tinta); }
.stat span { font-size: 12.5px; color: var(--suave); }
.stat--accent b { color: var(--coral-btn); }

/* Barras */
.bars { display: grid; gap: 9px; margin-top: 12px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar__track { display: block; height: 8px; background: var(--papel-2); border-radius: 99px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--salvia); border-radius: 99px; }
.bar--coral .bar__fill { background: var(--coral-btn); }
.bar b { text-align: right; color: var(--tinta); }

/* ── Formularios ───────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.field { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--suave); }
.field input, .field select, .field textarea {
  font: 400 14px/1.4 var(--body); color: var(--texto); background: var(--superficie);
  border: 1px solid var(--linea-2); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
.field textarea { min-height: 220px; resize: vertical; font-size: 13.5px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--salvia); outline: 2px solid var(--salvia-suave); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }

.btn {
  font: 600 14px/1 var(--body); border-radius: 8px; padding: 10px 14px; min-height: 38px;
  border: 1px solid var(--linea-2); background: var(--superficie); color: var(--tinta); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--tinta); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--coral-btn); border-color: var(--coral-btn); color: #fff; }
.btn--primary:hover { background: #A93A16; border-color: #A93A16; }
.btn--ok { background: var(--salvia); border-color: var(--salvia); color: #fff; }
.btn--ghost { background: transparent; }
.btn--danger { color: #9B2C12; border-color: rgba(155, 44, 18, .4); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Lista de oportunidades ────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--suave); padding: 12px; border-bottom: 1px solid var(--linea-2); background: var(--papel); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--linea); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #FBF8F2; }
.name { font-weight: 600; color: var(--tinta); }
.name small { display: block; font-weight: 400; color: var(--suave); font-size: 12.5px; }

.score { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font: 700 16px/1 var(--display); color: var(--tinta); background: conic-gradient(var(--c, var(--salvia)) calc(var(--v) * 1%), var(--papel-2) 0); position: relative; }
.score::after { content: ""; position: absolute; inset: 5px; background: var(--superficie); border-radius: 50%; }
.score span { position: relative; z-index: 1; }
.score[data-tier="alta"] { --c: var(--coral-btn); }
.score[data-tier="media"] { --c: var(--ambar); }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--papel-2); color: var(--texto); white-space: nowrap; }
.tag--ok { background: var(--salvia-suave); color: var(--salvia); }
.tag--warn { background: rgba(138, 90, 0, .1); color: var(--ambar); }
.tag--bad { background: rgba(200, 68, 27, .1); color: var(--coral-tx); }
.tag--stage { background: transparent; border: 1px solid var(--linea-2); }

.empty { padding: 40px 20px; text-align: center; color: var(--suave); }

/* ── Ficha (drawer) ────────────────────────────────────── */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(760px, 100vw); background: var(--papel); box-shadow: -20px 0 60px -20px rgba(19, 35, 43, .4); transform: translateX(102%); transition: transform .25s cubic-bezier(.2, .7, .2, 1); z-index: 50; overflow-y: auto; }
.drawer[aria-hidden="false"] { transform: none; }
.drawer__inner { padding: 24px clamp(16px, 3vw, 30px) 40px; }
.scrim { position: fixed; inset: 0; background: rgba(19, 35, 43, .35); z-index: 40; }
.ficha__top { display: flex; gap: 16px; align-items: start; justify-content: space-between; border-bottom: 2px solid var(--tinta); padding-bottom: 16px; margin-bottom: 18px; }
.ficha__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.section { margin-bottom: 22px; }
.section > h2 { font-size: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
dl.facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--suave); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.breakdown { display: grid; gap: 10px; }
.bd { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; }
.bd__label { font-weight: 600; color: var(--tinta); }
.bd__why { grid-column: 1 / -1; color: var(--suave); font-size: 13px; }
.bd__track { grid-column: 1 / -1; height: 6px; background: var(--papel-2); border-radius: 99px; overflow: hidden; }
.bd__track i { display: block; height: 100%; background: var(--salvia); }
.ops { display: grid; gap: 10px; }
.op { border-left: 3px solid var(--salvia); padding: 6px 0 6px 12px; }
.op[data-certeza="indicio"] { border-left-color: var(--papel-3); }
.op__t { font-weight: 600; color: var(--tinta); }
.op__e { font-size: 13.5px; color: var(--suave); margin: 2px 0; }
.notes { margin: 8px 0 0; padding-left: 18px; color: var(--ambar); font-size: 13.5px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--linea); }
.timeline time { color: var(--suave); font-size: 12.5px; }
.src { font-size: 12.5px; }
.src td, .src th { padding: 7px 8px; }
.proposal { background: var(--superficie); border: 1px solid var(--linea); border-radius: 10px; padding: 14px; display: grid; gap: 10px; margin-bottom: 12px; }
.proposal pre { white-space: pre-wrap; font: 13.5px/1.55 var(--body); margin: 0; background: var(--papel); padding: 12px; border-radius: 8px; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; background: rgba(138, 90, 0, .1); color: #5E3E00; margin-bottom: 14px; }
.alert--bad { background: rgba(200, 68, 27, .12); color: #7E2A0E; }

/* ── CRM kanban ─────────────────────────────────────────── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--papel-2); border-radius: var(--radio); padding: 10px; min-height: 200px; }
.col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; margin: 4px 4px 10px; color: var(--tinta); }
.card { background: var(--superficie); border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; display: grid; gap: 4px; text-align: left; width: 100%; font: inherit; color: inherit; }
.card:hover { border-color: var(--tinta); }
.card b { color: var(--tinta); font-size: 14px; }
.card small { color: var(--suave); font-size: 12.5px; }

/* ── Mapa ──────────────────────────────────────────────── */
.map-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
#map { height: min(70vh, 680px); border-radius: var(--radio); border: 1px solid var(--linea); z-index: 0; }
.legend { display: grid; gap: 8px; font-size: 13.5px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--linea-2); }
.leaflet-popup-content { font: 13.5px/1.45 var(--body); }
.leaflet-popup-content b { color: var(--tinta); }

/* ── Toast y pie ────────────────────────────────────────── */
.toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--tinta); color: #fff; padding: 11px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100vw - 32px); font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: #7E2A0E; }
.site-foot { background: var(--tinta); color: #AEB8BB; font-size: 12.5px; display: flex; gap: 12px 24px; justify-content: space-between; flex-wrap: wrap; padding: 16px clamp(16px, 3vw, 40px); position: relative; z-index: 2; }
.site-foot a { color: #E9E4DA; }
.site-foot .credit { color: var(--coral); font-weight: 600; text-decoration: none; }
.site-foot .credit:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(-n+3) { border-bottom: 1px solid var(--linea); }
  .map-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; height: auto; z-index: 30; padding: 12px 16px; gap: 10px; }
  .brand { grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; padding: 0; }
  .brand img { width: 110px; }
  .nav { grid-auto-flow: column; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .nav a[aria-current="page"]::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 2px; }
  .rail__foot { display: none; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .operator-inline { display: grid !important; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-right: 1px solid var(--linea) !important; border-bottom: 1px solid var(--linea); }
  .stat:nth-child(2n) { border-right: 0 !important; }
  .stat b { font-size: 26px; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dt { margin-top: 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .filters .field { flex: 1 1 140px; }
  .hide-sm { display: none; }
  .bar { grid-template-columns: 1fr 34px; }
  .bar .bar__track { grid-column: 1 / -1; grid-row: 2; }
}
.operator-inline { display: none; margin-bottom: 16px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
dialog.ask { border: 0; border-radius: var(--radio); padding: 20px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--sombra); background: var(--superficie); }
dialog.ask::backdrop { background: rgba(19, 35, 43, .45); }
.filters select { max-width: 260px; }
[hidden] { display: none !important; }
.rail, main { min-width: 0; }
@media (max-width: 900px) { .shell { grid-template-columns: minmax(0, 1fr); } }
.legend { align-content: start; align-self: start; }
.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { margin-bottom: 4px; }
.login .panel { margin-top: 18px; }
.operator { margin: 0; }
.operator b { display: block; color: #fff; font: 600 15px/1.3 var(--body); text-transform: none; letter-spacing: 0; margin-top: 4px; }
.operator small { color: var(--coral); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.btn--rail { background: var(--tinta-2); border-color: #2B4250; color: #E9E4DA; font-size: 12.5px; padding: 8px 10px; min-height: 32px; }
.btn--rail:hover { border-color: var(--coral); }
@media (max-width: 900px) { .rail__foot#userbox:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; } .rail__foot .rail__note { display: none; } .operator { display: flex; gap: 8px; align-items: baseline; } .operator span { display: none; } .operator b { margin: 0; font-size: 13.5px; } }
.agent h2 { font-size: 15px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--papel-3); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--salvia); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
