/* Jarvis — oscuro, sobrio, con un acento ámbar. Pensado para el teléfono (cerrado y abierto). */
:root {
  --fondo: #0b1020; --fondo2: #0f1629; --tarjeta: #151d33; --tarjeta2: #1b2542; --borde: #26304f;
  --texto: #e8ecf7; --texto2: #9aa6c6; --texto3: #6c7799;
  --ambar: #f5b942; --ambar2: #ffd27a; --cian: #4fd1ff; --verde: #4ade80; --rojo: #f87171; --lila: #a78bfa;
  --radio: 18px; --sombra: 0 10px 30px rgba(0,0,0,.35);
  --nav: 68px; --seguro-abajo: env(safe-area-inset-bottom, 0px);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); min-height: 100%; }
body { font-size: 16px; line-height: 1.45; overscroll-behavior-y: contain; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--cian); text-decoration: none; }
::selection { background: rgba(245,185,66,.35); }

/* ---------- marco ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.cabecera { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: rgba(11,16,32,.82);
  border-bottom: 1px solid rgba(38,48,79,.6); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; }
.cabecera .logo { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.cabecera h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: .2px; flex: 1; }
.cabecera .sub { font-size: 12px; color: var(--texto2); font-weight: 500; display: block; }
.cabecera .atras { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--texto); background: var(--tarjeta); }
.contenido { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--nav) + var(--seguro-abajo) + 24px); }
.contenido.ancho { max-width: 1180px; }
@media (min-width: 700px) { .dos-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; } }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--nav) + var(--seguro-abajo)); padding-bottom: var(--seguro-abajo);
  background: rgba(15,22,41,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--borde); display: flex; justify-content: center; }
.nav .fila { display: flex; width: 100%; max-width: 760px; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 8px; color: var(--texto3); font-size: 11.5px; font-weight: 600; position: relative; }
.nav button.activo { color: var(--ambar); }
.nav button svg { width: 24px; height: 24px; }
.nav .globo { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--rojo); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }

/* ---------- piezas ---------- */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra); }
.tarjeta h2 { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--texto2); display: flex; align-items: center; gap: 8px; }
.tarjeta h2 .der { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--texto3); }
.titulo-dia { font-size: 22px; font-weight: 700; margin: 4px 0 14px; }
.titulo-dia small { display: block; font-size: 13px; color: var(--texto2); font-weight: 500; text-transform: none; }
.muted { color: var(--texto2); } .chico { font-size: 13px; } .mini { font-size: 12px; color: var(--texto3); }
.vacio { text-align: center; color: var(--texto3); padding: 26px 10px; font-size: 14px; }
.vacio svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 13px; font-weight: 600; font-size: 15px;
  background: var(--tarjeta2); color: var(--texto); border: 1px solid var(--borde); transition: transform .08s, filter .15s; }
.boton:active { transform: scale(.97); } .boton:disabled { opacity: .5; pointer-events: none; }
.boton.primario { background: var(--ambar); color: #1a1200; border-color: transparent; }
.boton.peligro { color: var(--rojo); border-color: rgba(248,113,113,.35); }
.boton.fantasma { background: transparent; }
.boton.lleno { width: 100%; }
.boton svg { width: 18px; height: 18px; }
.fila-botones { display: flex; gap: 10px; flex-wrap: wrap; }
.fila-botones .boton { flex: 1; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--tarjeta2); color: var(--texto2); border: 1px solid var(--borde); white-space: nowrap; }
.chip.ambar { background: rgba(245,185,66,.14); color: var(--ambar2); border-color: rgba(245,185,66,.35); }
.chip.cian { background: rgba(79,209,255,.12); color: var(--cian); border-color: rgba(79,209,255,.3); }
.chip.verde { background: rgba(74,222,128,.12); color: var(--verde); border-color: rgba(74,222,128,.3); }
.chip.rojo { background: rgba(248,113,113,.14); color: var(--rojo); border-color: rgba(248,113,113,.35); }
.chip.lila { background: rgba(167,139,250,.14); color: var(--lila); border-color: rgba(167,139,250,.35); }
.chip svg { width: 13px; height: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip.opcion { cursor: pointer; } .chip.opcion.activa { background: var(--ambar); color: #1a1200; border-color: transparent; }

/* ---------- grabadora ---------- */
.grabadora { text-align: center; padding: 22px 16px 18px; position: relative; overflow: hidden; }
.grabadora .aro { width: 132px; height: 132px; margin: 6px auto 14px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.grabadora .aro::before, .grabadora .aro::after { pointer-events: none; }
.grabadora .aro::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(245,185,66,.35); }
.grabadora.grabando .aro::before { animation: pulso 1.4s ease-out infinite; border-color: rgba(248,113,113,.6); }
.grabadora.grabando .aro::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(248,113,113,.4); animation: pulso 1.4s ease-out .5s infinite; }
@keyframes pulso { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.grabadora .mic { position: relative; z-index: 2; touch-action: manipulation; width: 104px; height: 104px; border-radius: 50%; background: linear-gradient(160deg, var(--ambar2), var(--ambar) 60%, #d99a1f); color: #1a1200;
  display: grid; place-items: center; box-shadow: 0 12px 30px rgba(245,185,66,.35); transition: transform .1s; }
.grabadora .mic:active { transform: scale(.95); }
.grabadora.grabando .mic { background: linear-gradient(160deg, #ff9b9b, var(--rojo) 60%, #c43d3d); box-shadow: 0 12px 30px rgba(248,113,113,.35); color: #fff; }
.grabadora .mic svg { width: 44px; height: 44px; }
.grabadora .tiempo { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.grabadora .pista { color: var(--texto2); font-size: 14px; margin-top: 4px; }
.grabadora .acciones { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.onda { display: flex; align-items: center; justify-content: center; gap: 3px; height: 34px; margin: 8px 0 4px; }
.onda i { display: block; width: 4px; border-radius: 2px; background: var(--rojo); height: 8px; transition: height .12s; }

.previa { text-align: left; }
.previa audio { width: 100%; margin: 10px 0; filter: invert(.92) hue-rotate(180deg) saturate(.6); border-radius: 10px; }
.previa .destinos { margin: 8px 0 14px; }
textarea.campo, input.campo, select.campo { width: 100%; background: var(--fondo2); border: 1px solid var(--borde); border-radius: 12px; padding: 12px 14px; color: var(--texto); outline: none; }
textarea.campo { min-height: 120px; resize: vertical; line-height: 1.5; }
.campo:focus { border-color: var(--ambar); }
label.etq { display: block; font-size: 12.5px; color: var(--texto2); font-weight: 600; margin: 10px 0 6px; }

/* ---------- listas de notas ---------- */
.nota-item { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tarjeta2); border: 1px solid var(--borde); margin-bottom: 10px; cursor: pointer; align-items: flex-start; }
.nota-item:active { filter: brightness(1.1); }
.nota-item .ico { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--fondo2); color: var(--texto2); }
.nota-item .ico svg { width: 20px; height: 20px; }
.nota-item .ico.pendiente { color: var(--texto2); } .nota-item .ico.procesando { color: var(--cian); } .nota-item .ico.procesada { color: var(--verde); } .nota-item .ico.error { color: var(--rojo); }
.nota-item .cuerpo { flex: 1; min-width: 0; }
.nota-item .tit { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.nota-item .tit .hora { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--texto3); flex: none; }
.nota-item .res { color: var(--texto2); font-size: 13.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nota-item .pie { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.punto-nuevo { width: 8px; height: 8px; border-radius: 50%; background: var(--ambar); flex: none; }

/* ---------- detalle de nota ---------- */
.texto-nota { white-space: pre-wrap; line-height: 1.6; font-size: 15.5px; }
.texto-nota .wl { color: var(--cian); background: rgba(79,209,255,.1); padding: 0 5px; border-radius: 6px; font-weight: 500; }
.texto-nota .wl.dudoso { color: var(--ambar2); background: rgba(245,185,66,.14); }
.texto-nota .emb { color: var(--texto3); font-size: 13px; }
.texto-nota h3 { font-size: 16px; margin: 14px 0 6px; color: var(--ambar2); }
.texto-nota blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--borde); color: var(--texto2); background: var(--fondo2); border-radius: 0 10px 10px 0; }
.wikilinks { display: flex; flex-direction: column; gap: 8px; }
.wl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--tarjeta2); border: 1px solid var(--borde); cursor: pointer; }
.wl-item.dudoso { border-color: rgba(245,185,66,.45); background: rgba(245,185,66,.07); }
.wl-item.quitado { opacity: .55; text-decoration: line-through; }
.wl-item .flecha { color: var(--texto3); }
.wl-item .dicho { color: var(--texto2); } .wl-item .destino { font-weight: 600; color: var(--cian); flex: 1; }
.wl-item .estado { margin-left: auto; font-size: 12px; color: var(--texto3); }
.linea-tiempo { position: relative; padding-left: 22px; }
.linea-tiempo::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--borde); }
.ev { position: relative; padding: 4px 0 12px; }
.ev::before { content: ""; position: absolute; left: -19px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--texto3); border: 2px solid var(--tarjeta); }
.ev.ok::before { background: var(--verde); } .ev.mal::before { background: var(--rojo); } .ev.info::before { background: var(--cian); } .ev.ambar::before { background: var(--ambar); }
.ev .t { font-size: 12px; color: var(--texto3); } .ev .q { font-weight: 600; font-size: 14px; } .ev .d { font-size: 13px; color: var(--texto2); word-break: break-word; }
.dia-sep { font-size: 12px; font-weight: 700; color: var(--texto3); text-transform: uppercase; letter-spacing: .6px; margin: 16px 0 8px; }
.pregunta { padding: 12px 14px; border-radius: 12px; background: var(--tarjeta2); border: 1px solid var(--borde); margin-bottom: 8px; }
.pregunta .q { font-weight: 600; margin-bottom: 8px; }

/* ---------- modales y hojas ---------- */
.velo { position: fixed; inset: 0; background: rgba(5,8,18,.7); z-index: 50; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
@media (min-width: 700px) { .velo { align-items: center; } }
.hoja { width: 100%; max-width: 560px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + var(--seguro-abajo)); max-height: 90vh; overflow: auto; animation: subir .2s ease-out; }
@media (min-width: 700px) { .hoja { border-radius: 22px; } }
@keyframes subir { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.hoja h3 { margin: 0 0 12px; font-size: 17px; }
.hoja .asa { width: 42px; height: 4px; border-radius: 2px; background: var(--borde); margin: -6px auto 14px; }
.opciones-lista { display: flex; flex-direction: column; gap: 8px; }
.opciones-lista .boton { justify-content: flex-start; text-align: left; }
.aviso { position: fixed; left: 50%; bottom: calc(var(--nav) + var(--seguro-abajo) + 14px); transform: translateX(-50%); background: var(--tarjeta2); border: 1px solid var(--borde); color: var(--texto);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; z-index: 60; box-shadow: var(--sombra); max-width: 92vw; animation: subir .2s ease-out; }
.aviso.mal { border-color: rgba(248,113,113,.5); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, #1a2342, var(--fondo) 70%); }
.login .caja { width: 100%; max-width: 380px; text-align: center; }
.login .logo { width: 84px; height: 84px; border-radius: 26px; margin-bottom: 14px; box-shadow: 0 14px 40px rgba(245,185,66,.18); }
.login h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: .5px; } .login p { color: var(--texto2); margin: 0 0 22px; }
.login .campo { margin-bottom: 10px; text-align: left; }
.login .error { color: var(--rojo); font-size: 13.5px; margin: 8px 0; }

/* ---------- varios ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; } .kv b { font-weight: 600; } .kv span { color: var(--texto2); text-align: right; word-break: break-all; }
.token { font-family: "Source Code Pro", ui-monospace, monospace; font-size: 12.5px; background: var(--fondo2); padding: 8px 10px; border-radius: 10px; word-break: break-all; border: 1px solid var(--borde); }
.estado-obrero { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texto2); }
.estado-obrero i { width: 8px; height: 8px; border-radius: 50%; background: var(--texto3); display: inline-block; }
.estado-obrero.vivo i { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.estado-obrero.lejos i { background: var(--ambar); }
.dicc-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--tarjeta2); border: 1px solid var(--borde); margin-bottom: 8px; }
.dicc-item .oido { color: var(--texto2); } .dicc-item .correcto { font-weight: 600; flex: 1; }
.cargando { text-align: center; color: var(--texto3); padding: 30px; }
.cargando i { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--borde); border-top-color: var(--ambar); border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.inst { background: linear-gradient(135deg, rgba(245,185,66,.12), rgba(79,209,255,.08)); }

/* ---------- inicio (panel de herramientas) ---------- */
.saludo { margin: 4px 0 14px; }
.saludo h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: .2px; }
.saludo .fecha { color: var(--texto2); font-size: 14px; margin-top: 2px; }
.resumen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.resumen .dato { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px; padding: 12px 10px; text-align: center; }
.resumen .dato b { display: block; font-size: 22px; font-weight: 700; }
.resumen .dato span { font-size: 11.5px; color: var(--texto2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.resumen .dato.alerta b { color: var(--ambar2); } .resumen .dato.ok b { color: var(--verde); }
.seccion { font-size: 12px; font-weight: 700; color: var(--texto3); text-transform: uppercase; letter-spacing: .6px; margin: 18px 0 10px; }
.rejilla { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .rejilla { grid-template-columns: repeat(3, 1fr); } }
.herr { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 14px 14px; border-radius: var(--radio); background: var(--tarjeta); border: 1px solid var(--borde); box-shadow: var(--sombra); cursor: pointer; min-height: 118px; transition: transform .08s, border-color .15s; text-align: left; }
.herr:active { transform: scale(.97); }
.herr .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; }
.herr .ico svg { width: 24px; height: 24px; }
.herr.ambar .ico { background: rgba(245,185,66,.16); color: var(--ambar2); } .herr.cian .ico { background: rgba(79,209,255,.14); color: var(--cian); }
.herr.verde .ico { background: rgba(74,222,128,.14); color: var(--verde); } .herr.lila .ico { background: rgba(167,139,250,.16); color: var(--lila); }
.herr.rojo .ico { background: rgba(248,113,113,.14); color: var(--rojo); } .herr.gris .ico { background: var(--tarjeta2); color: var(--texto2); }
.herr .nom { font-weight: 700; font-size: 15.5px; } .herr .des { font-size: 12.5px; color: var(--texto2); margin-top: 3px; line-height: 1.35; }
.herr .globo { position: absolute; top: 12px; right: 12px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--rojo); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 7px; }
.herr.principal { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; background: linear-gradient(135deg, rgba(245,185,66,.18), rgba(79,209,255,.08)), var(--tarjeta); }
.herr.principal .ico { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(160deg, var(--ambar2), var(--ambar) 60%, #d99a1f); color: #1a1200; box-shadow: 0 10px 24px rgba(245,185,66,.3); flex: none; }
.herr.principal .ico svg { width: 28px; height: 28px; }
.herr.principal .des { margin-top: 2px; }
.herr.pronto { opacity: .55; cursor: default; border-style: dashed; }
.herr.pronto .nom::after { content: " · pronto"; font-weight: 500; color: var(--texto3); font-size: 12px; }
