/* Panel de Ruso v2. Identidad del panel anterior (papel cálido, naranja de marca, Inter + Bricolage Grotesque).
   El naranja se usa SOLO para acciones principales; los estados usan verde / ámbar / rojo. */
:root {
  --ink: #17191c; --ink-soft: #5d636b; --ink-faint: #9aa0a6;
  --paper: #f2f2ef; --card: #ffffff; --line: #e1e1dc; --line-soft: #ecece8;
  --accent: #e4512b; --accent-ink: #b8381a; --accent-soft: #fcece6;
  --ok: #15803d; --ok-bg: #e7f4ec; --warn: #b45309; --warn-bg: #f9efdc; --bad: #be123c; --bad-bg: #fce7ec;
  --r: 14px; --r-sm: 10px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --disp: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
a, button, input { touch-action: manipulation; }
h1, h2 { text-wrap: balance; }
.salto:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; background: var(--card); padding: 10px 14px; z-index: 20; border-radius: var(--r-sm); }
.main { scroll-margin-top: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--sans); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Armazón ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.rail { display: none; }
.main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 16px 96px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; text-align: center; padding: 13px 2px 12px; font-size: 13px; color: var(--ink-soft); text-decoration: none; border-top: 2px solid transparent; margin-top: -1px; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; border-top-color: var(--ink); }
.demo { background: var(--warn-bg); color: var(--warn); padding: 9px 16px; font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.demo button { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; font-weight: 600; }
@media (min-width: 900px) {
  .app-cuerpo { display: flex; flex: 1; }
  .rail { display: flex; flex-direction: column; width: 216px; flex: none; padding: 30px 20px; gap: 2px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
  .rail .marca { font: 600 26px/1 var(--disp); letter-spacing: -0.02em; }
  .rail .marca-sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 26px; }
  .rail a { padding: 9px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-soft); }
  .rail a:hover { background: var(--line-soft); }
  .rail a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--card); }
  .rail .pie { margin-top: auto; }
  .tabbar { display: none; }
  .main { padding: 34px 44px 64px; }
}

/* ---------- Texto ---------- */
.titulo { font: 600 24px/1.2 var(--disp); letter-spacing: -0.01em; }
.veredicto { font: 600 clamp(27px, 5.4vw, 42px)/1.12 var(--disp); letter-spacing: -0.018em; max-width: 24em; }
.veredicto-sub { margin-top: 10px; font-size: 17px; color: var(--ink-soft); max-width: 36em; }
.seccion { margin-top: 36px; }
.seccion > h2 { font: 600 20px/1.25 var(--disp); letter-spacing: -0.005em; margin-bottom: 4px; }
.seccion > .nota-seccion { color: var(--ink-soft); font-size: 14px; margin-bottom: 14px; max-width: 40em; }
.suave { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primario { background: var(--accent); color: #fff; }
.btn-primario:hover { background: var(--accent-ink); }
.btn-sec { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-sec:hover { background: var(--line-soft); }
.segmento { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--card); }
.segmento button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--ink-soft); min-height: 38px; }
.segmento button:hover { background: var(--line-soft); }
.chip:hover { background: var(--line-soft); }
.rail .pie button { background: none; border: 0; padding: 9px 12px; cursor: pointer; color: var(--ink-soft); text-align: left; }
.rail .pie button:hover { color: var(--ink); text-decoration: underline; }
.segmento button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fila-titulo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; cursor: pointer; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Salud ---------- */
.alertas { border-top: 1px solid var(--line); }
.alerta { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.alerta:hover { background: var(--card); }
.punto { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--ink-faint); }
.punto.alta { background: var(--bad); } .punto.media { background: var(--warn); } .punto.baja { background: var(--ink-faint); }
.alerta-titulo { font-weight: 600; }
.alerta-meta { display: flex; gap: 14px; color: var(--ink-soft); font-size: 14px; flex-wrap: wrap; }
.vacio { padding: 22px 4px; color: var(--ink-soft); max-width: 40em; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: right; font-weight: 500; font-size: 13px; color: var(--ink-soft); padding: 8px 6px; border-bottom: 1px solid var(--ink); }
.tabla th:first-child, .tabla td:first-child { text-align: left; }
.tabla td { padding: 12px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.tabla td:first-child { padding-left: 0; color: var(--ink); }
.tabla .ahora { font-weight: 600; font-size: 17px; }
.mejor { color: var(--ok); } .peor { color: var(--bad); } .igual { color: var(--ink-faint); }
@media (max-width: 560px) { .tabla .col-ant { display: none; } }
.barras { display: flex; align-items: flex-end; gap: 6px; height: 96px; padding-top: 6px; border-bottom: 1px solid var(--ink); }
.barra { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.barra i { display: block; width: 100%; max-width: 38px; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; }
.barra span { font-size: 12px; color: var(--ink-soft); }
.rotulos { display: flex; gap: 6px; margin-top: 6px; }
.rotulos span { flex: 1; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ---------- Conversaciones ---------- */
.conv { display: block; }
.conv-lista { border-top: 1px solid var(--line); }
.conv-detalle { display: none; }
.conv.con-detalle .conv-lista-bloque { display: none; }
.conv.con-detalle .conv-detalle { display: block; }
.fila { display: block; padding: 14px 6px; border-bottom: 1px solid var(--line); text-decoration: none; }
.fila:hover { background: var(--card); }
.fila[aria-current="true"] { background: var(--card); box-shadow: inset 3px 0 0 var(--ink); }
.fila-cab { min-width: 0; display: flex; justify-content: space-between; gap: 12px; }
.fila .nombre { font-weight: 600; }
.fila .cuando { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.fila-texto { color: var(--ink-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 6px; }
.etiquetas { display: flex; gap: 6px; flex-wrap: wrap; }
.etiqueta { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--line-soft); color: var(--ink-soft); }
.etiqueta.alta { background: var(--bad-bg); color: var(--bad); } .etiqueta.media { background: var(--warn-bg); color: var(--warn); }
.atras { margin-bottom: 14px; }
.conv-detalle, .conv-lista-bloque { min-width: 0; }
.chat { background: var(--card); border-radius: var(--r); padding: 18px 16px 8px; box-shadow: 0 1px 2px rgba(23,25,28,.05), 0 8px 28px rgba(23,25,28,.07); }
.chat-cab { padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.chat-cab .titulo { font-size: 22px; }
.chat-cab p { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.sep-dia { text-align: center; font-size: 12px; color: var(--ink-faint); margin: 16px 0 4px; }
.msg { margin: 14px 0; display: flex; flex-direction: column; max-width: 100%; }
.msg-ruso, .msg-proactivo, .msg-equipo { align-items: flex-end; }
.msg-socio { align-items: flex-start; }
.msg-quien { font-size: 12px; color: var(--ink-soft); margin: 0 4px 3px; }
.burbuja { padding: 10px 14px; border-radius: 16px; max-width: min(34em, 88%); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-socio .burbuja { background: var(--paper); border-bottom-left-radius: 4px; }
.msg-ruso .burbuja { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-ruso .burbuja a { color: #fff; }
.msg-proactivo .burbuja { background: var(--card); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.msg-equipo .burbuja { background: var(--accent-soft); border-bottom-right-radius: 4px; }
.pie-msg { font-size: 12px; color: var(--ink-soft); margin: 4px 4px 0; max-width: 34em; }
.nota-sistema { margin: 8px 0 0 auto; max-width: min(34em, 94%); padding: 10px 12px; border-left: 3px solid var(--ink-faint); background: var(--line-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14px; }
.nota-sistema.alta { border-color: var(--bad); background: var(--bad-bg); } .nota-sistema.media { border-color: var(--warn); background: var(--warn-bg); }
.nota-sistema b { display: block; margin-bottom: 2px; }
@media (min-width: 900px) {
  .conv { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 28px; align-items: start; }
  .conv.con-detalle .conv-lista-bloque { display: block; }
  .conv-detalle { display: block; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; }
  .atras { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .conv-detalle .chat { animation: abrir .18s ease-out; } @keyframes abrir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } } }

.historial { border-top: 1px solid var(--line); max-width: 46em; }
.hist { border-bottom: 1px solid var(--line); padding: 12px 6px; }
.hist summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; min-height: 32px; align-items: center; }
.hist summary .nombre { font-weight: 600; }
.hist summary .cuando { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.hist p { margin-top: 6px; overflow-wrap: anywhere; }
.hist:hover { background: var(--card); }

/* ---------- Acceso y estados ---------- */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.acceso-caja { width: 100%; max-width: 380px; background: var(--card); border-radius: var(--r); padding: 28px 24px; box-shadow: 0 1px 2px rgba(23,25,28,.05), 0 8px 28px rgba(23,25,28,.07); }
.acceso-caja .titulo { font-size: 30px; }
.acceso-caja p { color: var(--ink-soft); margin: 8px 0 18px; }
.acceso-caja label { display: block; font-weight: 600; margin-bottom: 6px; }
.acceso-caja input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; background: var(--paper); }
.acceso-caja .btn { width: 100%; margin-top: 14px; }
.error { color: var(--bad); margin-top: 10px; min-height: 22px; }
.proximo { max-width: 40em; margin-top: 18px; }
.proximo p { color: var(--ink-soft); margin-top: 8px; }
