/* Nexo 2.0 — tema oscuro, teléfono primero. Sigue la maqueta aprobada (trabajo/nexo2/maqueta.html). */
:root {
  --bg: #111318; --bg2: #0c0d11; --hoja: #13151b; --card: #1a1d24; --line: #272b35;
  --tx: #e8eaf0; --mut: #8f97a6; --or: #ff8a3d; --or2: #ffb37a;
  --ok: #3ecf8e; --warn: #f5c04a; --bad: #ff5d6c; --blue: #5aa9ff;
  --top-h: 56px;
  --tabs-h: calc(64px + env(safe-area-inset-bottom));
  --panel-w: 420px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
a { color: var(--or2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mut { color: var(--mut); font-size: 13px; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0; }

/* ---------- Logo ---------- */
.logo {
  width: 30px; height: 30px; border-radius: 8px; background: #1f2330; color: #fff;
  display: grid; place-items: center; font-weight: 800; position: relative; flex: none;
}
.logo::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--or); right: 3px; top: 3px; }
.logo-grande { width: 64px; height: 64px; border-radius: 18px; font-size: 32px; }
.logo-grande::after { width: 13px; height: 13px; right: 7px; top: 7px; }

/* ---------- Arranque y acceso ---------- */
.arranque { position: fixed; inset: 0; display: grid; place-items: center; }
.arranque .logo { animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .45; transform: scale(.94); } }
.acceso { min-height: 100%; display: grid; place-items: center; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.acceso-caja { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 6px; }
.acceso-caja .logo { margin-bottom: 8px; }
.acceso-caja h1 { font-size: 24px; margin: 4px 0 0; }
.acceso-caja .mut { margin: 0 0 14px; font-size: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mut); margin-top: 6px; }
.campo input {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 16px; color: var(--tx);
}
.campo input:focus { border-color: var(--or); outline: none; }

/* ---------- Botones ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 650; font-size: 14px; min-height: 44px; }
.btn.grande { padding: 14px; font-size: 16px; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.b1 { background: var(--or); color: #111; }
.b2 { background: #262b37; color: var(--tx); }
.b3 { background: none; color: var(--mut); }
.acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.acts .btn { flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: 14px; }
.ask {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--or2);
  background: none; border: 0; padding: 6px 0; min-height: 36px;
}

/* ---------- Estructura ---------- */
.app { position: fixed; inset: 0; display: flex; }
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  min-height: calc(var(--top-h) + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.top .t { font-weight: 700; font-size: 17px; }
.estado { margin-left: auto; font-size: 12px; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estado.quieto { color: var(--mut); }
.avisos {
  margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 99px;
  color: var(--mut); font-size: 12px; padding: 4px 10px; min-height: 32px; white-space: nowrap; flex: none;
}
.avisos + .estado { margin-left: 8px; }
.scr { flex: 1; overflow-y: auto; padding: 12px max(14px, env(safe-area-inset-right)) 24px max(14px, env(safe-area-inset-left)); outline: none; -webkit-overflow-scrolling: touch; }
.vista { max-width: 720px; margin: 0 auto; }

/* ---------- Barra de pestañas ---------- */
.tabs {
  display: flex; align-items: flex-end; border-top: 1px solid var(--line); background: #0f1116;
  padding-bottom: env(safe-area-inset-bottom); position: relative; z-index: 30; flex: none;
}
.tabs button {
  flex: 1; background: none; border: 0; color: var(--mut); padding: 9px 0 11px; font-size: 11px;
  position: relative; min-height: 56px;
}
.tabs button i { display: block; font-style: normal; font-size: 20px; line-height: 1.3; }
.tabs button.on { color: var(--or); }
.tabs .nx { flex: 1.1; color: var(--or); font-weight: 700; }
.tabs .nx i {
  width: 56px; height: 56px; margin: -26px auto 2px; border-radius: 50%; background: var(--or); color: #111;
  display: grid; place-items: center; font-size: 23px; box-shadow: 0 4px 16px #ff8a3d55; border: 4px solid var(--bg2);
  transition: transform .15s;
}
.tabs .nx:active i { transform: scale(.94); }
.badge {
  position: absolute; top: -28px; left: calc(50% + 12px); background: var(--bad); color: #fff; font-size: 11px;
  font-weight: 800; border-radius: 99px; min-width: 20px; height: 20px; display: grid; place-items: center;
  border: 2px solid var(--bg2); padding: 0 5px; z-index: 1;
}

/* ---------- Estados vacíos y de carga ---------- */
.vacio { text-align: center; color: var(--mut); padding: 40px 16px; font-size: 14px; }
.vacio .e { font-size: 34px; display: block; margin-bottom: 8px; }
.vacio .btn { margin-top: 12px; }
.esq { background: linear-gradient(90deg, #1a1d24 0%, #222632 50%, #1a1d24 100%); background-size: 200% 100%; animation: brillo 1.3s linear infinite; border-radius: 14px; }
@keyframes brillo { to { background-position: -200% 0; } }
.esq.linea { height: 14px; margin: 8px 0; border-radius: 6px; }
.esq.tarjeta { height: 120px; margin: 10px 0; }
.esq.fila { height: 56px; margin: 6px 0; border-radius: 10px; }

/* ---------- Hoy ---------- */
.greet { font-size: 19px; font-weight: 700; margin: 2px 0; }
.parte { background: linear-gradient(135deg, #1d2230, #1a1d24); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 12px 0; }
.parte p { margin: 4px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: #232836; color: #cfd5e2; }
.aviso-envios { font-size: 13px; color: var(--warn); background: #2a2414; border: 1px solid #4a3d1a; border-radius: 12px; padding: 9px 11px; margin: 10px 0; }
.dec { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; transition: opacity .3s; }
.dec .h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--mut); }
.dec .ttl { font-weight: 650; margin: 6px 0 4px; font-size: 15px; }
.dec.done { opacity: .45; }
.dec.done .acts, .dec.done .borr { pointer-events: none; }
.why { font-size: 13px; color: #b9c0cd; border-left: 3px solid var(--or); padding-left: 8px; margin: 6px 0; }
.borr {
  background: #13261d; border-radius: 10px 10px 10px 2px; padding: 9px 11px; font-size: 14px; margin: 8px 0;
  white-space: pre-wrap; word-break: break-word; outline: none; border: 1px solid transparent;
}
.borr[contenteditable]:focus { border-color: #2f6b4c; }
.borr-ayuda { font-size: 11px; color: var(--mut); margin-top: -4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.hot { background: var(--bad); } .warm { background: var(--warn); } .cold { background: var(--blue); }
.ag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #262b37; color: #cfd5e2; }
.calla { font-size: 13px; color: var(--mut); background: #15171d; border: 1px dashed #2c303b; border-radius: 12px; padding: 10px; margin: 12px 0; }
.sec-t { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px; }
.agenda-it { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.agenda-it .cu { color: var(--or2); font-size: 13px; min-width: 76px; flex: none; }
.pend-it { padding: 9px 0; border-bottom: 1px solid var(--line); }
.pend-it .cu { color: var(--or2); font-size: 12px; margin-top: 2px; }
.agenda-it .lu { font-size: 12px; color: var(--mut); }

/* ---------- Personas ---------- */
.seg { display: flex; background: var(--card); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; color: var(--mut); padding: 9px; border-radius: 8px; font-weight: 600; min-height: 40px; }
.seg button.on { background: #2a2f3c; color: var(--tx); }
.buscar {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; color: var(--tx); margin-bottom: 6px;
}
.buscar:focus { border-color: #454c5c; outline: none; }
.row {
  display: flex; gap: 10px; align-items: center; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line);
  width: 100%; background: none; text-align: left; min-height: 60px;
}
.row:hover { background: #15181f; }
.av {
  width: 40px; height: 40px; border-radius: 50%; background: #262b37; display: grid; place-items: center;
  font-weight: 700; flex: none; overflow: hidden;
}
.av { position: relative; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row .c { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row .n { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.row .n span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .l { display: block; color: var(--mut); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r { display: block; overflow: hidden; text-align: right; font-size: 12px; color: var(--mut); flex: none; max-width: 34%; }
.row .r .et { display: block; color: #cfd5e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ficha de una persona */
.atras { background: none; border: 0; color: var(--mut); padding: 6px 0; margin-bottom: 4px; font-size: 14px; min-height: 40px; }
.ficha-cab { display: flex; gap: 12px; align-items: center; margin: 4px 0 10px; }
.ficha-cab .av { width: 56px; height: 56px; font-size: 22px; }
.ficha-cab h2 { margin: 0; font-size: 19px; }
.ficha-cab .tel { font-size: 13px; color: var(--mut); }
.bloque { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.bloque h3 { margin: 0 0 6px; font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.bloque p { margin: 0; }
.bloque ul { margin: 0; padding-left: 18px; }
.siguiente { border-left: 3px solid var(--or); }
.mini { max-width: 85%; margin: 6px 0; padding: 7px 10px; border-radius: 12px; font-size: 14px; background: #222632; word-break: break-word; }
.mini.mio { margin-left: auto; background: #2b3a55; }
.mini .tm { display: block; font-size: 10px; color: var(--mut); text-align: right; margin-top: 2px; }
.btn-nexo { width: 100%; margin: 12px 0 4px; }

/* ---------- Cartera ---------- */
.prop {
  display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; margin: 8px 0; width: 100%; text-align: left; align-items: stretch;
}
.prop:hover { border-color: #353a47; }
.ph {
  width: 78px; min-height: 66px; border-radius: 9px; background: linear-gradient(135deg, #2b3446, #1c2230);
  flex: none; display: grid; place-items: center; font-size: 24px; overflow: hidden;
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.prop .c { flex: 1; min-width: 0; }
.prop .c b { display: block; }
.prop .pre { color: var(--or2); font-size: 13px; font-weight: 600; }
.bar { height: 6px; border-radius: 9px; background: #262b37; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 9px; }
.bar .ok { background: var(--ok); } .bar .warn { background: var(--warn); } .bar .bad { background: var(--bad); }
.prop .pie { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--mut); }
.prop .pie a { margin-left: auto; font-size: 12px; white-space: nowrap; }

/* ---------- Equipo ---------- */
.agent { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 8px 0; }
.agent .e { font-size: 22px; line-height: 1.2; }
.agent .c { flex: 1; min-width: 0; }
.agent .n { font-weight: 650; }
.sw {
  margin-left: auto; font-size: 12px; padding: 6px 10px; border-radius: 8px; background: #262b37; color: #cfd5e2;
  white-space: nowrap; border: 0; min-height: 34px; flex: none;
}
.sw.avisame { background: #3a3220; color: var(--warn); }
.sw.solo { background: #1f3b2c; color: var(--ok); }
.gasto .cifras { display: flex; gap: 8px; margin-top: 4px; }
.gasto .cifras div { flex: 1; background: #14171d; border-radius: 10px; padding: 8px; font-size: 12px; color: var(--mut); }
.gasto .cifras b { display: block; font-size: 18px; color: var(--tx); }
.bita { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.bita .cu { color: var(--mut); font-size: 12px; min-width: 52px; flex: none; padding-top: 2px; }
.bita .ag2 { color: var(--or2); font-weight: 600; }
.salir { margin: 22px auto 0; display: block; }

/* ---------- Hoja de conversaciones ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px);
  background: var(--hoja); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s; visibility: hidden;
  z-index: 20; display: flex; flex-direction: column; padding-bottom: calc(var(--tabs-h) + 24px); box-shadow: 0 -10px 30px #0009;
}
.sheet.on { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.sh { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px; border-bottom: 1px solid var(--line); position: relative; min-height: 60px; }
.sh .grab { position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; border-radius: 9px; background: #3a3f4b; transform: translateX(-50%); }
.sh .tt { min-width: 0; flex: 1; }
.sh .tt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib { background: #262b37; border: 0; color: var(--tx); border-radius: 9px; padding: 8px 11px; font-size: 13px; flex: none; min-height: 38px; min-width: 38px; }
.ctx { font-size: 11px; color: var(--or2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filt { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; flex: none; }
.filt::-webkit-scrollbar { display: none; }
.filt button { flex: none; background: var(--card); border: 1px solid var(--line); color: var(--mut); border-radius: 99px; padding: 6px 12px; font-size: 12px; min-height: 32px; }
.filt button.on { color: var(--tx); border-color: #454c5c; background: #232836; }
.list { flex: 1; overflow-y: auto; }
.th {
  display: flex; gap: 10px; padding: 10px 12px; border: 0; border-bottom: 1px solid #1f232c; align-items: flex-start;
  width: 100%; background: none; text-align: left;
}
.th:hover { background: #171a21; }
.th .ico { width: 42px; height: 42px; border-radius: 12px; background: #1f2330; display: grid; place-items: center; font-size: 20px; flex: none; position: relative; }
.th .ico.nexo::after {
  content: "N"; position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--or); color: #111; font-size: 10px; font-weight: 900; display: grid; place-items: center; border: 2px solid var(--hoja);
}
.th .c { flex: 1; min-width: 0; }
.th .c b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.th .p { display: block; font-size: 13px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .meta { text-align: right; font-size: 11px; color: var(--mut); flex: none; }
.th .un { display: inline-block; margin-top: 4px; background: var(--or); color: #111; font-weight: 800; border-radius: 99px; min-width: 18px; padding: 0 5px; font-size: 11px; text-align: center; }
.th.unread b { color: #fff; font-weight: 700; }
.th.arch { opacity: .55; }
.who2 { display: block; font-size: 10px; color: var(--or2); }
.sec2 { font-size: 11px; color: var(--mut); padding: 12px 12px 2px; text-transform: uppercase; letter-spacing: .05em; }

/* Conversación abierta */
.conv { flex: 1; display: none; flex-direction: column; min-height: 0; }
.sheet.inconv .conv { display: flex; }
.sheet.inconv .list, .sheet.inconv .filt { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px; overscroll-behavior: contain; }
.m { max-width: 88%; margin: 8px 0; padding: 9px 12px; border-radius: 14px; font-size: 14px; word-break: break-word; }
.m.n { background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; }
.m.u { background: #2b3a55; margin-left: auto; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.m .tm { display: block; font-size: 10px; color: var(--mut); margin-top: 3px; text-align: right; }
.m.error { border-color: #5a2830; }
.m.error .md { color: #ffb3bb; }
.day { text-align: center; font-size: 11px; color: var(--mut); margin: 12px 0; }
.who { font-size: 11px; color: var(--or); font-weight: 700; display: block; margin-bottom: 2px; }
.via { font-size: 10px; color: #7fd3a8; margin-left: 4px; font-weight: 500; }
/* Markdown de Nexo */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md blockquote { margin: 8px 0; background: #14171d; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.md code { background: #14171d; border-radius: 5px; padding: 1px 4px; font-size: 13px; }
.md pre { background: #14171d; border-radius: 10px; padding: 8px; overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.md td, .md th { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.md img { max-width: 100%; border-radius: 8px; }
.md h1, .md h2, .md h3 { font-size: 15px; margin: 10px 0 4px; }
/* Progreso mientras Nexo trabaja */
.progreso { color: var(--mut); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.progreso .pt { display: inline-flex; gap: 3px; }
.progreso .pt i { width: 5px; height: 5px; border-radius: 50%; background: var(--mut); animation: salto 1s infinite ease-in-out; }
.progreso .pt i:nth-child(2) { animation-delay: .15s; } .progreso .pt i:nth-child(3) { animation-delay: .3s; }
@keyframes salto { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.progreso .txt { background: linear-gradient(90deg, var(--mut) 40%, #d5dae4 50%, var(--mut) 60%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: brillo 2s linear infinite; }
.m .progreso + .md:not(:empty) { margin-top: 6px; }
/* Tarjeta de lienzo dentro del mensaje */
.lzc {
  display: flex; gap: 10px; align-items: center; margin-top: 9px; background: #161b26; border: 1px solid #2f3a52;
  border-radius: 12px; padding: 8px 10px; width: 100%; text-align: left;
}
.lzc:hover { border-color: #415178; }
.lzc .ico { width: 38px; height: 38px; border-radius: 9px; background: #22304a; display: grid; place-items: center; font-size: 19px; flex: none; }
.lzc .k { font-size: 10px; color: #8fb3ff; letter-spacing: .05em; }
.lzc b { display: block; }
/* Borrador dentro del mensaje */
.bm { background: #14171d; border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-top: 9px; }
.bm .para { font-size: 11px; color: var(--mut); margin-bottom: 4px; }
.bm textarea {
  width: 100%; background: #13261d; color: var(--tx); border: 1px solid transparent; border-radius: 10px;
  padding: 8px 10px; font-size: 14px; resize: none; min-height: 60px; overflow: hidden;
}
.bm textarea:focus { border-color: #2f6b4c; outline: none; }
.bm .acts { margin-top: 6px; }
.bm .estado-b { font-size: 12px; color: var(--ok); margin-top: 6px; }
.bm .estado-b.listo { color: var(--warn); }
.bm.cerrado textarea { background: #15201a; opacity: .8; }
/* Sugerencias y caja de escribir */
.sug { display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px; scrollbar-width: none; flex: none; }
.sug::-webkit-scrollbar { display: none; }
.sug button { flex: none; background: var(--card); border: 1px solid var(--line); color: #cfd5e2; border-radius: 99px; padding: 7px 12px; font-size: 13px; min-height: 34px; }
.inp { display: flex; gap: 6px; padding: 6px 12px 10px; align-items: flex-end; flex: none; }
.inp textarea {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); color: var(--tx); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; resize: none; max-height: 140px; line-height: 1.35;
}
.inp textarea:focus { border-color: #454c5c; outline: none; }
.inp button { background: var(--or); color: #111; border: 0; border-radius: 12px; width: 46px; height: 46px; font-size: 17px; flex: none; }
.inp button:disabled { opacity: .5; }

/* ---------- Lienzo ---------- */
.lz { position: fixed; inset: 0; background: #0e1014; z-index: 40; display: flex; flex-direction: column; }
.lzh {
  display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
}
.lzh b { flex: 1; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lzh .btn { min-height: 40px; padding: 8px 12px; }
.lz iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 64px); max-width: 480px; margin: 0 auto;
  background: #1d2230; border: 1px solid #3a4560; color: var(--tx); border-radius: 14px; padding: 11px 13px;
  font-size: 14px; z-index: 60; box-shadow: 0 8px 24px #000a; text-align: left; width: auto;
  animation: entra .25s ease-out;
}
.toast.accion { cursor: pointer; }
.toast b { color: var(--or); }
@keyframes entra { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- PC: la hoja pasa a panel lateral fijo ---------- */
@media (min-width: 1000px) {
  .sheet {
    position: relative; inset: auto; top: auto; transform: none; visibility: visible; transition: none;
    width: var(--panel-w); flex: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line);
    padding-bottom: 0; box-shadow: none; padding-top: env(safe-area-inset-top);
  }
  .sh { padding-top: 12px; min-height: calc(var(--top-h) + 1px); }
  .sh .grab, .cerrar-hoja { display: none; }
  .scr { padding: 20px 28px 32px; }
  .tabs { justify-content: center; }
  .tabs button { flex: 0 1 130px; }
  .tabs .nx { flex: 0 1 140px; }
  .toast { left: auto; right: calc(var(--panel-w) + 20px); width: 380px; }
}
@media (min-width: 1400px) { :root { --panel-w: 460px; } }

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

/* Ficha de cada agente (modal): hoja desde abajo en el teléfono, centrada en la PC */
.agent[data-acc="agente"] { cursor: pointer; }
.agent[data-acc="agente"]:hover { border-color: #3a404e; }
.ag-info { color: var(--or2); font-size: 13px; font-weight: 400; margin-left: 2px; }
body.con-modal { overflow: hidden; }
.agm-fondo { position: fixed; inset: 0; z-index: 70; background: #000a; display: flex; align-items: flex-end; justify-content: center; }
.agm {
  position: relative; width: 100%; max-height: 92vh; overflow-y: auto; background: var(--hoja); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); animation: agm-sube .22s ease-out;
}
@keyframes agm-sube { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 760px) {
  .agm-fondo { align-items: center; }
  .agm { max-width: 620px; border-radius: 20px; max-height: 86vh; }
}
.agm-x { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; }
.agm h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.agm p { margin: 6px 0; line-height: 1.5; }
.ag-cab { display: flex; gap: 12px; align-items: center; padding-right: 44px; flex-wrap: wrap; }
.ag-cab h3 { margin: 0; font-size: 19px; }
.ag-ico { font-size: 30px; width: 52px; height: 52px; border-radius: 14px; background: #1f2330; display: grid; place-items: center; flex: none; }
.ag-cab > div { flex: 1; min-width: 160px; }
.ag-est { font-size: 11px; padding: 3px 9px; border-radius: 99px; font-weight: 700; }
.ag-est.ok { background: #1f3b2c; color: var(--ok); } .ag-est.warn { background: #3a3220; color: var(--warn); }
.ag-est.blue { background: #1d2a40; color: var(--blue); } .ag-est.mut { background: #262b37; color: var(--mut); }
.ag-cuando { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ag-cuando span { font-size: 12px; padding: 4px 9px; border-radius: 99px; background: #232836; color: #cfd5e2; }
.ag-seg { display: flex; background: var(--card); border-radius: 12px; padding: 3px; gap: 2px; }
.ag-seg button { flex: 1; border: 0; background: none; color: var(--mut); padding: 10px 4px; border-radius: 9px; font-weight: 600; font-size: 13px; min-height: 44px; }
.ag-seg button.on { background: #2a2f3c; color: var(--tx); }
.ag-niv { padding-top: 6px; }
.ag-ej { margin: 10px 0; }
.ag-usar { width: 100%; margin-top: 6px; }
.ag-actual { color: var(--ok); font-weight: 600; text-align: center; }
.ag-nota { font-size: 13px; color: #d9c48a; background: #2a2414; border: 1px solid #4a3d1d; border-radius: 10px; padding: 9px 11px; margin-top: 12px !important; }

/* Ejemplos visuales (maquetas dentro de la ficha) */
.ej-dec { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.ej-h { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--mut); flex-wrap: wrap; }
.ej-h .ag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #262b37; }
.ej-t { font-weight: 650; margin: 6px 0 4px; }
.ej-why { font-size: 13px; color: #b9c0cd; border-left: 3px solid var(--or); padding-left: 8px; margin: 6px 0; }
.ej-msg { background: #13261d; border-radius: 10px 10px 10px 2px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }
.ej-acts { display: flex; gap: 6px; margin-top: 8px; }
.ej-acts span { flex: 1; text-align: center; border-radius: 10px; padding: 9px 4px; font-weight: 650; font-size: 13px; }
.ej-acts .b1 { background: var(--or); color: #111; } .ej-acts .b2 { background: #262b37; } .ej-acts .b3 { color: var(--mut); }
.ej-push { display: flex; gap: 10px; align-items: flex-start; background: #1d2230; border: 1px solid #3a4560; border-radius: 16px; padding: 11px 12px; font-size: 13px; box-shadow: 0 8px 24px #0006; }
.ej-push b { color: var(--tx); } .ej-push > div { flex: 1; color: #cfd5e2; }
.ej-logo { width: 30px; height: 30px; border-radius: 8px; background: #1f2330; display: grid; place-items: center; font-weight: 800; position: relative; flex: none; }
.ej-logo::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--or); right: 3px; top: 3px; }
.ej-hora { font-size: 11px; color: var(--mut); }
.ej-bita { background: #15171d; border: 1px dashed #2c303b; border-radius: 12px; padding: 6px 10px; font-size: 13px; }
.ej-bita div { padding: 6px 0; border-bottom: 1px solid #1f232c; display: flex; gap: 10px; }
.ej-bita div:last-child { border-bottom: 0; }
.ej-bita span { color: var(--mut); font-size: 12px; min-width: 52px; }
.ej-lz { background: #f6f4f0; color: #1d1d1f; border-radius: 14px; padding: 14px; }
.ej-lz-t { font-weight: 700; margin-bottom: 10px; font-size: 14px; }
.ej-bar { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 13px; }
.ej-bar .n { width: 78px; color: #555; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ej-bar .b { flex: 1; height: 16px; background: #e6e0d8; border-radius: 5px; overflow: hidden; }
.ej-bar .b i { display: block; height: 100%; background: #7c9cc9; border-radius: 5px; }
.ej-bar .b i.rojo { background: #ff5d6c; }
.ej-bar .v { min-width: 44px; text-align: right; font-weight: 600; font-size: 12px; }
.ej-nota { font-size: 12px; color: #777; margin-top: 8px; }
.ej-emb { margin: 6px auto; background: linear-gradient(90deg, #c9a77c, #7c5a3a); color: #fff; border-radius: 9px; padding: 8px 10px; text-align: center; font-size: 13px; }
.ej-emb b { font-size: 16px; }
.ej-linea { display: flex; flex-direction: column; gap: 0; }
.ej-hito { position: relative; padding: 0 0 12px 22px; font-size: 13px; border-left: 2px solid #d9d2c7; margin-left: 6px; }
.ej-hito:last-child { border-left-color: transparent; }
.ej-hito .p { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #c9a77c; }
.ej-hito.ok .p { background: #3ecf8e; border-color: #3ecf8e; }
.ej-hito b { display: block; color: #7c5a3a; font-size: 12px; }
.ej-check { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #e6e0d8; font-size: 14px; }
.ej-check span { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c9b9a3; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.ej-check.ok span { background: #3ecf8e; border-color: #3ecf8e; } .ej-check:not(.ok) { color: #a33; }
.ej-carr { display: grid; gap: 8px; }
.ej-carr div { background: #fff; border-radius: 10px; padding: 10px; border-left: 4px solid #7c9cc9; font-size: 13px; }
.ej-carr div.col { border-left-color: #c9a77c; }
.ej-carr b { display: block; margin-bottom: 2px; }
.ej-rep { background: #fff; color: #222; border-radius: 14px; padding: 14px; font-size: 13px; }
.ej-rep > b { font-size: 16px; color: #0b3d5c; display: block; margin: 2px 0; }
.ej-kp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.ej-kp div { background: #eef4f8; border-radius: 9px; padding: 7px; text-align: center; font-size: 12px; }
.ej-kp b { display: block; font-size: 18px; color: #0b3d5c; }
.mut2 { color: #888; font-size: 12px; }
