/* YAKUX CRM. Marca: negro YAKUX en la barra lateral, y el degradado azul-verde
   de la marca convertido en la ruta de las 8 etapas. */
:root {
  --bg: #eceef3;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --ink: #0f121f;
  --ink-2: #454a5c;
  --muted: #767b8d;
  --line: rgba(15, 18, 31, .1);
  --line-2: rgba(15, 18, 31, .06);
  --blue: #3f67f0;
  --green: #05a37d;
  --danger: #c93a3a;
  --side: #08090d;
  --side-ink: #f6f7fb;
  --side-muted: #8d90a0;
  --focus: 0 0 0 3px rgba(63, 103, 240, .4);
  --shadow: 0 1px 2px rgba(15, 18, 31, .05), 0 12px 32px rgba(15, 18, 31, .08);
  --r-lg: 16px;
  --r: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #08090d;
  --surface: #101116;
  --surface-2: #171920;
  --ink: #f6f7fb;
  --ink-2: #c3c6d2;
  --muted: #8d90a0;
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .06);
  --side: #040506;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "DM Sans", system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.drawer-open { overflow: hidden; }
@media (min-width: 1180px) { body.drawer-open { overflow: auto; } }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
small { font-size: 12.5px; color: var(--muted); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }

/* ---------- marca ---------- */
.brand { font-weight: 700; letter-spacing: .16em; font-size: 15px; }
.brand span { font-weight: 500; letter-spacing: .02em; color: var(--side-muted); margin-left: 8px; }
.brand-ink span { color: var(--muted); }

/* ---------- avatar ---------- */
.av {
  --av: #0f121f;
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--av) 16%, var(--surface));
  color: var(--av); font-weight: 700; font-size: 14px;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--av) 40%, transparent);
}
:root[data-theme="dark"] .av { color: color-mix(in srgb, var(--av) 55%, white); }
.side .av, .mtop .av { background: color-mix(in srgb, var(--av) 30%, #08090d); color: #fff; }
.av.sm { width: 24px; height: 24px; font-size: 11px; }
.av.lg { width: 48px; height: 48px; font-size: 19px; }
.av-empty { --av: #767b8d; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 85%, var(--blue)); }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; display: inline-grid; place-items: center; color: inherit; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn.bordered { border: 1px solid var(--line); width: 40px; height: 40px; background: var(--surface); }
.link-btn { color: var(--muted); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; gap: 6px; align-items: center; }
.link-btn:hover { color: var(--ink); }
.link-btn.danger { color: var(--danger); text-decoration: none; }
.link-btn.danger .ic { width: 16px; height: 16px; }
.inline-link { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; text-align: left; }
.inline-link:hover { text-decoration-color: currentColor; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); }
.login-main { padding: 56px clamp(20px, 7vw, 96px); display: flex; flex-direction: column; justify-content: center; max-width: 640px; }
.login-main h1 { font-size: clamp(30px, 4vw, 42px); margin: 48px 0 12px; line-height: 1.1; }
.lead-p { color: var(--ink-2); max-width: 48ch; margin-bottom: 28px; }
.who-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.who {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.who span:not(.av) { display: flex; flex-direction: column; flex: 1; }
.who:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.who:hover .go { transform: translateX(3px); color: var(--ink); }
.who .go { color: var(--muted); transition: transform .15s; }
.login-main .link-btn { align-self: flex-start; }
.login-art {
  background: var(--side); color: var(--side-ink);
  padding: 56px clamp(24px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 32px;
}
.login-art p { color: var(--side-muted); font-size: 17px; max-width: 30ch; }
.ruta { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.ruta li {
  counter-increment: r; position: relative; padding: 0 0 22px 40px; font-size: 19px; font-weight: 500;
  animation: ruta-in .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 1ms);
}
.ruta li::before {
  content: ""; position: absolute; left: 6px; top: 7px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent);
}
.ruta li:not(:last-child)::after {
  content: ""; position: absolute; left: 11px; top: 22px; bottom: 0; width: 2px;
  background: linear-gradient(var(--c), color-mix(in srgb, var(--c) 30%, transparent));
}
.ruta li:nth-child(1) { --i: 0; } .ruta li:nth-child(2) { --i: 60; } .ruta li:nth-child(3) { --i: 120; } .ruta li:nth-child(4) { --i: 180; }
.ruta li:nth-child(5) { --i: 240; } .ruta li:nth-child(6) { --i: 300; } .ruta li:nth-child(7) { --i: 360; } .ruta li:nth-child(8) { --i: 420; }
@keyframes ruta-in { from { opacity: 0; transform: translateY(6px); } }

/* login real */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); text-align: center; padding: 16px; }
.login-form { display: flex; flex-direction: column; gap: 14px; max-width: 400px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.login-form input { width: 100%; height: 46px; font-weight: 400; }
.btn-wide { width: 100%; height: 48px; font-size: 15px; }
.login-help { margin-top: 20px; color: var(--muted); font-size: 13.5px; max-width: 400px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink-2); }
.steps a { color: var(--blue); font-weight: 600; }
.rep header { position: relative; }
.rep-edit { position: absolute; top: 0; right: 0; }
.pool-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.contact-who small { margin-top: 2px; }
.modal-body .link-btn { align-self: flex-start; }
.modal-body input[type="file"] { font-size: 14px; }
.modal-body select { font-weight: 400; }

/* ---------- estructura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 14px 16px;
}
.side .brand { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 32px; }
.nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
  color: var(--side-muted); font-weight: 500; text-align: left;
}
.nav button:hover { color: var(--side-ink); background: rgba(255, 255, 255, .05); }
.nav button[aria-current="page"] { color: var(--side-ink); background: rgba(255, 255, 255, .09); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.ghost-side { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--side-muted); font-size: 14px; }
.ghost-side:hover { color: var(--side-ink); background: rgba(255, 255, 255, .05); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me div { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.me small { color: var(--side-muted); }
.me .icon-btn { color: var(--side-muted); }
.me .icon-btn:hover { color: var(--side-ink); background: rgba(255, 255, 255, .07); }
.mtop, .bottom { display: none; }
.main { padding: 32px clamp(20px, 3vw, 40px) 64px; min-width: 0; max-width: 1320px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; line-height: 1.15; }
.page-head p { color: var(--muted); margin-top: 4px; }
.money { display: flex; gap: 28px; margin: 0; }
.money div { display: flex; flex-direction: column; }
.money dt { font-size: 12.5px; color: var(--muted); }
.money dd { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }

/* ---------- la ruta: resumen por etapas ---------- */
.pipe {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 8px; margin-bottom: 20px; gap: 2px;
}
.pipe-col {
  display: grid; grid-template-rows: auto auto auto auto; text-align: left; gap: 6px;
  padding: 14px 12px 12px; border-radius: 11px; transition: background .15s;
}
.pipe-col:hover { background: var(--surface-2); }
.pipe-name { font-size: 13px; color: var(--ink-2); font-weight: 500; line-height: 1.25; min-height: 2.5em; }
.pipe-bar { display: flex; align-items: flex-end; height: 112px; border-bottom: 2px solid var(--c); }
.pipe-bar i {
  display: block; width: 100%; border-radius: 6px 6px 0 0;
  height: max(3px, calc(var(--h) * 100%));
  background: linear-gradient(color-mix(in srgb, var(--c) 85%, white), var(--c));
  transform-origin: bottom; animation: grow .7s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes grow { from { transform: scaleY(0); } }
.pipe-n { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.pipe-pct { font-size: 12.5px; color: var(--muted); }

/* ---------- paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; }
.panel-head p { color: var(--muted); font-size: 13.5px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.cols .panel { margin-bottom: 0; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.team { width: 100%; border-collapse: collapse; }
.team th { font-size: 12.5px; color: var(--muted); font-weight: 500; text-align: left; padding: 0 12px 10px; }
.team td { padding: 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.team tbody tr { cursor: pointer; transition: background .12s; }
.team tbody tr:hover { background: var(--surface-2); }
.team .num { text-align: right; font-weight: 600; }
.team .num small { display: block; font-weight: 400; }
.team .muted-cell { color: var(--muted); font-size: 14px; white-space: nowrap; }
.dist-cell { width: 34%; }
.person { display: flex; align-items: center; gap: 12px; }
.person span:not(.av) { display: flex; flex-direction: column; line-height: 1.25; }
.dist { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--line-2); gap: 2px; }
.dist i { display: block; height: 100%; min-width: 3px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding: 9px 0 9px 18px; position: relative; font-size: 14px; border-top: 1px solid var(--line-2); }
.feed li:first-child { border-top: 0; }
.feed li::before { content: ""; position: absolute; left: 0; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.feed time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.feed .res { color: var(--ink-2); }

.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 78%, var(--ink));
  background: color-mix(in srgb, var(--c) 13%, transparent);
}

.stall { list-style: none; margin: 0; padding: 0; }
.stall button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; text-align: left; padding: 10px 8px; border-radius: 9px; }
.stall li + li button { border-top: 1px solid var(--line-2); border-radius: 0; }
.stall button:hover { background: var(--surface-2); border-radius: 9px; }
.stall-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.stall-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stall-days { font-size: 13px; color: #b06a12; font-weight: 600; white-space: nowrap; }
:root[data-theme="dark"] .stall-days { color: #e4a54a; }

/* ---------- leads ---------- */
.seg-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; }
.seg-toggle button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { box-shadow: var(--focus); border-color: transparent; }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; color: var(--ink); height: 100%; }
.search kbd { font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
select, input[type="number"], input[type="date"], input[type="email"], input:not([type]), textarea {
  height: 42px; padding: 0 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767b8d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
textarea { height: auto; padding: 10px 12px; resize: vertical; width: 100%; line-height: 1.5; }
select:focus-visible, input:focus-visible, textarea:focus-visible { border-color: transparent; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); padding: 0 4px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  --c: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--ink-2);
}
.chip span { font-size: 12px; color: var(--muted); }
.chip:hover { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: color-mix(in srgb, var(--c) 55%, transparent); color: var(--ink); }
.chip[aria-pressed="true"] span { color: inherit; }

.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .9fr);
  gap: 16px; align-items: center; width: 100%; text-align: left; padding: 13px 18px; border-top: 1px solid var(--line-2);
  transition: background .12s;
}
.rows.is-admin .row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row.is-open { background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.r-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.r-name b, .r-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-city { color: var(--ink-2); font-size: 14px; }
.r-stage { display: flex; flex-direction: column; gap: 5px; }
.r-stage small { color: color-mix(in srgb, var(--c, var(--ink)) 70%, var(--ink)); font-weight: 600; font-size: 12.5px; }
.r-owner { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.r-when { color: var(--muted); font-size: 13px; text-align: right; }
.tag { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); margin-left: 4px; }
.tag-red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.empty-box { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 40px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; color: var(--ink-2); }

/* la barra de etapas de cada lead */
.track { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; max-width: 200px; }
.track .seg { height: 6px; border-radius: 3px; background: var(--line); }
.track .seg.on { background: var(--c); }
.track-lg { max-width: none; gap: 5px; position: relative; }
.track-lg .seg { height: 14px; border-radius: 5px; position: relative; transition: transform .15s, background .2s; }
.track-lg .seg:hover { transform: scaleY(1.35); }
.track-lg .seg.cur { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.track-lg .seg::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px);
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
}
.track-lg .seg:hover::after, .track-lg .seg:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.track-lg .seg:first-child::after { left: 0; transform: translate(0, 4px); }
.track-lg .seg:first-child:hover::after { transform: none; }
.track-lg .seg:last-child::after { left: auto; right: 0; transform: translate(0, 4px); }
.track-lg .seg:last-child:hover::after { transform: none; }
.seg.pop { animation: pop .5s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop { 40% { transform: scaleY(1.8); } }

/* problema detectado */
.ptags { display: flex; flex-wrap: wrap; gap: 4px; }
.r-name .ptags { margin-top: 5px; }
.card .ptags { margin-top: 6px; }
.ptag { font-style: normal; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 99px; white-space: nowrap; color: #9a5a0c; background: rgba(224, 146, 40, .14); }
.ptag-rev { color: #a33a3a; background: rgba(214, 69, 69, .12); }
:root[data-theme="dark"] .ptag { color: #f0b665; background: rgba(240, 160, 60, .15); }
:root[data-theme="dark"] .ptag-rev { color: #f08b8b; background: rgba(240, 100, 100, .14); }
.problem { border-radius: 14px; padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.problem-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.problem-head h3 { margin: 0; }
.gstars { font-weight: 700; font-size: 14px; color: #b7791f; white-space: nowrap; }
.gstars small { font-weight: 400; }
.motivo { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; color: var(--ink-2); }
.problem blockquote { margin: 0; padding: 10px 14px; border-left: 3px solid #d64545; background: var(--surface); border-radius: 0 10px 10px 0; }
.problem blockquote p { font-size: 14.5px; }
.problem cite { font-style: normal; font-size: 12.5px; color: var(--muted); }
.offer { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.offer span { font-size: 12.5px; font-weight: 600; color: var(--green); }
.offer p { font-size: 14.5px; font-weight: 500; }
.problem-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.problem-links a { color: var(--blue); font-weight: 600; text-underline-offset: 3px; }
.guion summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.guion pre { white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.55; margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); }

/* ---------- tablero ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(236px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 10px; min-height: 240px; transition: background .15s, border-color .15s; }
:root[data-theme="dark"] .col { background: var(--surface); }
.col.over { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.col header { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 10px; border-bottom: 2px solid var(--c); margin-bottom: 10px; }
.col h3 { font-size: 14px; }
.col header span { font-size: 12.5px; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 290px); overflow-y: auto; }
.card {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 11px 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line); cursor: grab; line-height: 1.3;
  transition: box-shadow .15s, transform .15s;
}
:root[data-theme="dark"] .card { background: var(--surface-2); }
.card:hover { box-shadow: var(--shadow); }
.card b { font-size: 14px; }
.card.dragging { opacity: .4; transform: rotate(-1.5deg); }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.card-foot time { margin-left: auto; }
.money-tag { font-weight: 600; color: var(--green); }
.more { font-size: 12.5px; color: var(--muted); text-align: center; padding: 10px 4px; }

/* ---------- comerciales ---------- */
.pool { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--r-lg); border: 1px dashed color-mix(in srgb, var(--ink) 22%, transparent); margin-bottom: 20px; }
.pool p { color: var(--muted); font-size: 14px; }
.reps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.rep header { display: flex; gap: 14px; align-items: center; }
.rep h3 { font-size: 18px; }
.rep header p { color: var(--muted); font-size: 13.5px; line-height: 1.35; }
.rep dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.rep dt { font-size: 12px; color: var(--muted); }
.rep dd { margin: 0; font-weight: 600; font-size: 17px; }
.rep footer { display: flex; gap: 8px; margin-top: auto; }
.rep footer .btn { flex: 1; }

/* ---------- ranking ---------- */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
}
.rank-row.is-me { border-color: color-mix(in srgb, var(--blue) 55%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 30%, transparent); }
.rank-row.is-first { background: linear-gradient(110deg, color-mix(in srgb, #4f7bff 10%, var(--surface)), color-mix(in srgb, #06bb91 12%, var(--surface))); }
.rank-pos { font-size: 26px; font-weight: 700; color: var(--muted); text-align: center; letter-spacing: -.02em; }
.is-first .rank-pos { color: var(--green); }
.rank-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rank-who > span:not(.av) { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rank-who b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-who small { color: var(--blue); font-weight: 600; }
.rank-stats { display: grid; grid-template-columns: repeat(4, minmax(72px, auto)); gap: 18px; margin: 0; text-align: right; }
.rank-stats dt { font-size: 12px; color: var(--muted); }
.rank-stats dd { margin: 0; font-size: 20px; font-weight: 600; }
.rank-stats small { display: block; font-size: 12px; color: var(--green); font-weight: 600; }
.rank-main dd { font-size: 26px; }
.rank-note { color: var(--ink-2); font-size: 14px; margin-bottom: 14px; }
.rank-help { color: var(--muted); font-size: 12.5px; margin-top: 16px; max-width: 70ch; }

/* ---------- ficha ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 9, 13, .4); animation: fade .2s both; z-index: 40; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slide-in .28s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }
@media (min-width: 1180px) {
  #drawer-root .scrim { background: transparent; animation: none; }
}
.drawer-head { display: flex; justify-content: space-between; gap: 12px; padding: 20px 20px 16px 24px; border-bottom: 1px solid var(--line-2); }
.drawer-head h2 { font-size: 21px; line-height: 1.2; }
.drawer-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.drawer-body { overflow-y: auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 22px; overscroll-behavior: contain; }
.drawer-body h3 { font-size: 14.5px; margin-bottom: 10px; }

.contact { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.contact-who { display: flex; flex-direction: column; line-height: 1.3; }
.contact-who span { color: var(--ink-2); font-size: 14px; }
.contact-actions { display: flex; gap: 8px; }
.btn-call { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-call:hover:not(:disabled) { background: #3358db; }
.btn-wa { color: #128c4f; }
:root[data-theme="dark"] .btn-wa { color: #4cd38a; }

.stage-box { border-radius: 14px; padding: 18px; background: color-mix(in srgb, var(--c) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); display: flex; flex-direction: column; gap: 14px; }
.stage-now { display: flex; flex-direction: column; }
.stage-now span { font-size: 12.5px; color: var(--muted); }
.stage-now strong { font-size: 22px; letter-spacing: -.01em; color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.btn-next { width: 100%; height: 46px; background: var(--c); border-color: var(--c); color: #fff; font-size: 15px; }
.btn-next:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 85%, black); }
.btn-next .ic { transition: transform .15s; }
.btn-next:hover .ic { transform: translateX(3px); }
.done { font-weight: 600; color: var(--green); }
.hint { font-size: 12.5px; color: var(--muted); }

.sale { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); }
.sale div { display: flex; flex-direction: column; }
.sale span { font-size: 12.5px; color: var(--muted); }
.sale-paid { grid-column: 1 / -1; gap: 6px; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-row label { font-weight: 600; font-size: 14.5px; }
.field-row select { min-width: 200px; }

.call { display: flex; flex-direction: column; gap: 10px; }
.call h3 { margin-bottom: 0; }
.res-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.res-chips .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.call .btn { align-self: flex-start; }
.notes-head { display: flex; justify-content: space-between; align-items: baseline; }
.saved { font-size: 12.5px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; display: flex; justify-content: space-between; gap: 12px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6.5px; top: 19px; bottom: 2px; width: 1px; background: var(--line); }
.timeline b { font-size: 14px; font-weight: 600; }
.timeline .h-asignacion b, .timeline .h-descarte b, .timeline .h-recuperado b { font-weight: 500; color: var(--ink-2); }
.timeline p { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.timeline small { white-space: nowrap; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 18px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-wrap .scrim { z-index: 0; }
.modal {
  position: relative; z-index: 1; width: min(460px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); animation: modal-in .22s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 0 22px; }
.modal h2 { font-size: 19px; }
.modal-body { padding: 10px 22px 6px; display: flex; flex-direction: column; gap: 14px; }
.modal-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.modal-body input, .modal-body select { width: 100%; font-weight: 400; }
.m-sub { color: var(--muted); font-size: 14px; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-preview { font-size: 14px; font-weight: 600; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r); }
.m-asig { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.m-asig > p { font-size: 14px; font-weight: 600; }
.m-error { color: var(--danger); font-size: 13.5px; min-height: 1em; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; width: max-content; max-width: calc(100% - 32px); }
.toast {
  display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  animation: toast-in .25s cubic-bezier(.2, .8, .2, 1) both;
}
.toast button { color: inherit; font-weight: 700; padding: 6px 10px; border-radius: 7px; background: color-mix(in srgb, var(--bg) 14%, transparent); white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  .dist-cell { width: 26%; }
}

/* ---------- móvil ---------- */
@media (max-width: 860px) {
  .shell { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .mtop {
    display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 30;
    background: var(--side); color: var(--side-ink); padding: 10px 12px 10px 16px;
  }
  .mtop .brand { margin-right: auto; }
  .mtop .icon-btn { color: var(--side-muted); }
  .me-btn { padding: 6px; border-radius: 99px; }
  .bottom {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
  .bottom button .ic { width: 22px; height: 22px; }
  .bottom button[aria-current="page"] { color: var(--ink); }
  .main { padding: 20px 16px 32px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head h1 { font-size: 25px; }
  .money { gap: 22px; width: 100%; }
  .money dd { font-size: 18px; }

  .pipe { grid-template-columns: 1fr; padding: 6px; gap: 0; }
  .pipe-col { grid-template-columns: 104px minmax(0, 1fr) 36px 40px; grid-template-rows: auto; align-items: center; padding: 9px 10px; gap: 10px; }
  .pipe-name { min-height: 0; }
  .pipe-bar { height: 10px; border-bottom: 0; align-items: stretch; background: var(--line-2); border-radius: 99px; overflow: hidden; }
  .pipe-bar i { height: 100%; width: max(4px, calc(var(--h) * 100%)); border-radius: 99px; background: var(--c); transform-origin: left; animation-name: grow-x; }
  @keyframes grow-x { from { transform: scaleX(0); } }
  .pipe-n { font-size: 17px; margin: 0; text-align: right; }
  .pipe-pct { text-align: right; }

  .panel { padding: 16px; }
  .team thead { display: none; }
  .team, .team tbody, .team tr, .team td { display: block; }
  .team tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; padding: 14px 4px; border-top: 1px solid var(--line-2); }
  .team tr:first-child { border-top: 0; }
  .team td { padding: 0; border: 0; }
  .team td:first-child, .team .dist-cell { grid-column: 1 / -1; width: auto; }
  .team .num, .team .muted-cell { text-align: left; font-size: 15px; }
  .team td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
  .team .muted-cell { font-size: 13px; white-space: normal; }
  .stall button { grid-template-columns: minmax(0, 1fr) auto; }
  .stall-days { grid-column: 1 / -1; font-size: 12.5px; margin-top: -6px; }

  .toolbar { gap: 8px; }
  .search { flex-basis: 100%; }
  .search kbd { display: none; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .seg-toggle span { display: none; }
  .seg-toggle button { padding: 0 11px; }

  .rows { border-radius: 14px; }
  .row, .rows.is-admin .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name when" "stage stage" "meta meta"; gap: 8px 12px; padding: 14px 16px; }
  .r-name { grid-area: name; }
  .r-when { grid-area: when; align-self: start; font-size: 12px; }
  .r-stage { grid-area: stage; flex-direction: row; align-items: center; gap: 10px; }
  .r-stage .track { flex: 1; max-width: none; }
  .r-city { grid-area: meta; font-size: 13px; color: var(--muted); }
  .r-owner { display: none; }

  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }

  .drawer { width: 100%; border-left: 0; animation-name: sheet-in; }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
  .drawer-head { padding: 14px 12px 12px 18px; }
  .drawer-body { padding: 18px 18px calc(32px + env(safe-area-inset-bottom)); }
  .contact { flex-direction: column; align-items: stretch; }
  .contact-actions .btn { flex: 1; height: 46px; }
  .contact-actions .icon-btn.bordered { height: 46px; width: 46px; }
  .track-lg .seg { height: 22px; }
  .track-lg .seg::after { display: none; }
  .field-row select { min-width: 0; flex: 1; }
  .call .btn { align-self: stretch; height: 46px; }

  .rank-row { grid-template-columns: 32px minmax(0, 1fr); padding: 14px 16px; gap: 10px 12px; }
  .rank-pos { font-size: 22px; }
  .rank-stats { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: left; padding-top: 10px; border-top: 1px solid var(--line-2); }
  .rank-stats dd { font-size: 17px; }
  .rank-main dd { font-size: 20px; }
  .page-head .seg-toggle { width: 100%; }
  .page-head .seg-toggle button { flex: 1; justify-content: center; padding: 0 6px; font-size: 13px; }
  .login { grid-template-columns: 1fr; }
  .login-main { padding: 32px 16px 40px; }
  .login-main h1 { margin-top: 36px; }
  .login-art { display: none; }
  .rep dl { grid-template-columns: repeat(2, 1fr); }
  .m-grid { grid-template-columns: 1fr; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { font-size: 13.5px; }
}

body.quiet *, body.quiet *::before, body.quiet *::after { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
