:root {
  /* Colores de Pibitos Media (pibitosmedia.com), en versión clara para uso diario */
  --ink: #0f0f0e;
  --ink-raised: #1a1a18;
  --bone: #f5f0e0;
  --amber: #efa01e;
  --bg: #f8f5ec;
  --surface: #fffdf7;
  --surface-2: #f6f2e6;
  --border: #e7e0cd;
  --border-strong: #d5ccb5;
  --text: #0f0f0e;
  --muted: #6b6860;
  --faint: #8e8a80;
  --accent: #efa01e;
  --accent-text: #9a5f00;
  --accent-soft: rgb(239 160 30 / .16);
  --good: #2f7d4f;
  --good-soft: #e6f1e8;
  --bad: #c2412f;
  --bad-soft: #f9e7e2;
  --warn: #9a5f00;
  --warn-soft: rgb(239 160 30 / .18);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 15, 14, .05), 0 4px 16px rgba(15, 15, 14, .04);
  --shadow-lg: 0 2px 4px rgba(15, 15, 14, .05), 0 12px 40px rgba(15, 15, 14, .09);
  --font: 'Archivo', 'Helvetica Neue', Arial, ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ── barra ── */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 60px;
  background: var(--ink); color: var(--bone);
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--bone); letter-spacing: -0.01em; }
.marca:hover { text-decoration: none; }
.marca-logo { width: 22px; height: 22px; border-radius: 7px; background: var(--amber); position: relative; }
.marca-logo::after { content: ''; position: absolute; left: 6px; top: 5px; width: 8px; height: 5px; border: solid var(--ink); border-width: 0 0 2.4px 2.4px; transform: rotate(-45deg); }
.nav { display: flex; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px;
  color: #aeaaa0; font-weight: 500; font-size: 14px; position: relative;
}
.nav a:hover { color: var(--bone); background: rgba(245, 240, 224, .07); text-decoration: none; }
.nav a.activo { color: var(--bone); background: var(--ink-raised); box-shadow: inset 0 -2px 0 var(--amber); }
.nav svg { width: 18px; height: 18px; display: none; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--amber); color: var(--ink);
}
.badge:empty { display: none; }
.badge.alerta { background: var(--bad); color: #fff; }

.main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 14px; }

/* ── piezas comunes ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.chip .punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.e-nuevo { background: rgb(239 160 30 / .16); color: #9a5f00; }
.e-aprobado { background: #e6f1e8; color: #2f7d4f; }
.e-descartado { background: #efebe0; color: #8e8a80; }
.e-contactado { background: #ebe7f6; color: #5b45a8; }
.e-respondió { background: #fbe9c8; color: #8a5200; }
.e-llamada { background: #e1eef0; color: #1d6b78; }
.e-propuesta { background: #f6e3d6; color: #a2491c; }
.e-cerrado { background: #0f0f0e; color: #f5f0e0; }
.e-perdido { background: #f9e7e2; color: #c2412f; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primario { background: var(--ink); border-color: var(--ink); color: var(--bone); }
.btn-primario:hover { background: #2a2a26; }
.btn-chico { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-fantasma { border-color: transparent; background: transparent; color: var(--muted); }
.btn-fantasma:hover { background: rgba(0, 0, 0, .04); color: var(--text); }

.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select.input { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6c66' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }

.filtros { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filtros .input { width: auto; min-width: 150px; height: 36px; font-size: 14px; }
.filtros .buscar { flex: 1 1 220px; }
.filtro-fecha { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.filtro-fecha .input { min-width: 0; }

kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); font: 600 11.5px var(--font); color: var(--muted);
}
.vacio { text-align: center; padding: 64px 20px; color: var(--muted); }
.vacio strong { display: block; font-size: 18px; color: var(--text); margin-bottom: 6px; }
.cargando { padding: 60px; text-align: center; color: var(--faint); }
.error-box { padding: 20px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); }

/* ── Revisar ── */
.revisar { max-width: 620px; margin: 0 auto; }
.contador { font-size: 14px; color: var(--muted); font-weight: 500; }
.contador b { color: var(--text); font-size: 22px; font-weight: 700; margin-right: 4px; font-variant-numeric: tabular-nums; }
.pila { position: relative; }
.pila::before, .pila::after {
  content: ''; position: absolute; left: 18px; right: 18px; bottom: -8px; height: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); z-index: -1;
}
.pila::after { left: 36px; right: 36px; bottom: -15px; opacity: .6; z-index: -2; }
.pila.sola::before, .pila.sola::after { display: none; }
.tarjeta { padding: 28px; box-shadow: var(--shadow-lg); touch-action: pan-y; user-select: none; }
.tarjeta.entra { animation: entra .22s ease-out; }
.tarjeta.sale-der { animation: sale-der .18s ease-in forwards; }
.tarjeta.sale-izq { animation: sale-izq .18s ease-in forwards; }
@keyframes entra { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes sale-der { to { opacity: 0; transform: translateX(60px) rotate(2deg); } }
@keyframes sale-izq { to { opacity: 0; transform: translateX(-60px) rotate(-2deg); } }
.tarjeta-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tarjeta h2 { font-size: 26px; font-weight: 700; line-height: 1.2; }
.tarjeta .lugar { color: var(--muted); margin-top: 4px; }
.dato { margin: 20px 0 0; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.dato-label { font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.dato p { margin: 0; font-size: 15.5px; }
.tarjeta-pie { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.origen { font-size: 13px; color: var(--faint); }
.link-perfil { font-weight: 600; }
.motivo { margin-top: 18px; }
.votar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.votar .btn { height: 54px; font-size: 16px; font-weight: 600; border-radius: 12px; }
.btn-no { color: var(--bad); }
.btn-no:hover { background: var(--bad-soft); border-color: #eec5bb; }
.btn-si { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-si:hover { background: #e09012; }
.atajos { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; margin-top: 26px; font-size: 13px; color: var(--muted); }
.atajos span { display: inline-flex; align-items: center; gap: 6px; }

/* ── Pendientes ── */
.lista { display: grid; gap: 12px; }
.pendiente { padding: 18px 20px; display: grid; gap: 14px; transition: opacity .25s, transform .25s; }
.pendiente.hecho { opacity: 0; transform: translateX(30px); }
.pendiente-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pendiente-head h2 a { color: var(--text); }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.espera { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 10px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.espera.tarde { background: var(--warn-soft); color: var(--warn); }
.espera.muy-tarde { background: var(--bad-soft); color: var(--bad); }
.pendiente-campos { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }

/* ── Pipeline ── */
.tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; background: var(--surface-2);
}
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }
th:hover { color: var(--text); }
th .flecha { color: var(--accent-text); margin-left: 4px; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: pointer; transition: background .08s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.nombre { font-weight: 500; }
td.num { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ── Ficha ── */
.volver { display: inline-flex; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.ficha-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ficha-head h1 { font-size: 30px; }
.ficha-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ficha-col { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .ancho { grid-column: 1 / -1; }
.form-acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.datos { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 14px 0 0; font-size: 14px; }
.datos dt { color: var(--muted); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface); }
.timeline li::after { content: ''; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t-tipo { font-weight: 600; }
.timeline .t-meta { color: var(--muted); font-size: 13px; }
.timeline li.t-primer::before { background: #6b3fd4; }
.timeline li.t-resp::before { background: var(--warn); }
.timeline li.t-joaco::before { background: var(--good); }
.timeline li.t-bloqueo::before { background: var(--bad); }
.registrar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.registrar .ancho { grid-column: 1 / -1; }

/* ── Métricas ── */
.rango { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rango .input { width: auto; height: 34px; font-size: 14px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #ece5d2; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button.activo { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.met-grid { display: grid; gap: 18px; }
.met-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hero { padding: 24px; display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 28px; align-items: center; }
.hero-num { font-size: 52px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: 22px; color: var(--faint); font-weight: 600; letter-spacing: -0.01em; }
.hero-label { color: var(--muted); margin-top: 8px; font-size: 14px; }
.barras { display: grid; gap: 14px; }
.barra-fila { display: grid; grid-template-columns: 140px 1fr 86px; gap: 12px; align-items: center; font-size: 14px; }
.barra-fila .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.barra-fila .num b { color: var(--text); font-weight: 600; }
.track { height: 8px; border-radius: 4px; background: #ece5d2; overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 4px; background: var(--amber); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.track > i.lleno { background: var(--ink); }
.track > i.excede { background: var(--bad); }
.track.grande { height: 12px; border-radius: 6px; }
.etiqueta-bloq { font-size: 11.5px; color: var(--warn); font-weight: 600; }
.tabla-met td, .tabla-met th { cursor: default; }
.tabla-met tbody tr { cursor: default; }
.tabla-met tbody tr:hover { background: transparent; }
.celda-tasa { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.celda-tasa .track { flex: 1; }
.celda-tasa span { width: 40px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.nota { font-size: 12.5px; color: var(--faint); margin-top: 10px; }

/* ── Config ── */
.config { max-width: 640px; }
.config section + section { margin-top: 18px; }
.limites { display: grid; gap: 10px; margin-top: 14px; }
.limite-fila { display: grid; grid-template-columns: 1fr 110px; gap: 12px; align-items: center; }
.limite-fila .input { text-align: right; font-variant-numeric: tabular-nums; }

.switch-wrap { display: flex; justify-content: flex-end; }
.switch { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch:checked { background: var(--amber); }
.switch:checked::after { transform: translateX(18px); }

/* ── toasts ── */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 11px; font-size: 14px; box-shadow: var(--shadow-lg); animation: entra .2s ease-out; display: flex; gap: 12px; align-items: center; }
.toast.error { background: var(--bad); }
.toast.ok { background: var(--ink); }
.toast button { background: transparent; border: 0; color: var(--amber); font-weight: 600; cursor: pointer; padding: 0; }

/* ── celular ── */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .barra { height: 52px; padding: 0 16px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--ink); border-top: 1px solid #2a2a26;
  }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 5px 4px; flex: 1; }
  .nav a.activo { background: transparent; box-shadow: none; color: var(--amber); }
  .nav svg { display: block; }
  .nav .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 14px; }
  .filtros .input { min-width: 0; flex: 1 1 140px; }
  .tarjeta { padding: 20px; }
  .tarjeta h2 { font-size: 22px; }
  .votar .btn { height: 58px; }
  .atajos { display: none; }
  .pendiente-campos { grid-template-columns: 1fr; }
  .ficha-grid, .met-dos, .form-grid, .registrar { grid-template-columns: 1fr; }
  .ficha-head h1 { font-size: 24px; }
  .hero { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .hero-num { font-size: 42px; }
  .barra-fila { grid-template-columns: 1fr 74px; gap: 6px 10px; }
  .barra-fila .track { grid-column: 1 / -1; grid-row: 2; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
