/* Jarvis · panel del hogar. Identidad propia: noche tranquila + ámbar cálido. */
:root {
  --fondo: #f6f3ee;
  --fondo-2: #ffffff;
  --fondo-3: #efeae2;
  --borde: #e2dbcf;
  --texto: #1d2230;
  --texto-2: #5d6474;
  --texto-3: #8a909c;
  --acento: #b8742a;
  --acento-2: #d58f3f;
  --acento-suave: #f6e7d3;
  --sobre-acento: #ffffff;
  --ok: #2f8a5b;
  --ok-suave: #e1f2e8;
  --peligro: #c0453b;
  --peligro-suave: #f9e3e0;
  --info: #3c6db0;
  --info-suave: #e3ecf8;
  --sombra: 0 1px 2px rgb(20 24 36 / 6%), 0 4px 16px rgb(20 24 36 / 6%);
  --radio: 14px;
  --radio-s: 9px;
  --fuente: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0f1420;
    --fondo-2: #161c2b;
    --fondo-3: #1d2436;
    --borde: #2a3247;
    --texto: #e9e6df;
    --texto-2: #a6abb8;
    --texto-3: #747b8c;
    --acento: #e8a85c;
    --acento-2: #f2bd7c;
    --acento-suave: #3a2c1c;
    --sobre-acento: #1b1408;
    --ok: #5cc28d;
    --ok-suave: #173326;
    --peligro: #ee7d72;
    --peligro-suave: #3a1d1b;
    --info: #79a6e8;
    --info-suave: #1b2a42;
    --sombra: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #0f1420; --fondo-2: #161c2b; --fondo-3: #1d2436; --borde: #2a3247;
  --texto: #e9e6df; --texto-2: #a6abb8; --texto-3: #747b8c;
  --acento: #e8a85c; --acento-2: #f2bd7c; --acento-suave: #3a2c1c; --sobre-acento: #1b1408;
  --ok: #5cc28d; --ok-suave: #173326; --peligro: #ee7d72; --peligro-suave: #3a1d1b;
  --info: #79a6e8; --info-suave: #1b2a42;
  --sombra: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 24px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo); color: var(--texto); font-family: var(--fuente);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--acento); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- Estructura ---- */
.marco { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.lateral {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--borde);
  background: var(--fondo-2); display: flex; flex-direction: column; gap: 4px;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; font-weight: 700; font-size: 1.05rem; }
.marca img { width: 30px; height: 30px; }
.marca small { display: block; font-weight: 500; font-size: .75rem; color: var(--texto-3); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radio-s);
  color: var(--texto-2); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--fondo-3); color: var(--texto); }
.nav a.activo { background: var(--acento-suave); color: var(--acento); }
.nav svg { width: 18px; height: 18px; flex: none; }
.lateral .pie { margin-top: auto; padding: 10px; font-size: .8rem; color: var(--texto-3); }
.contenido { padding: 28px clamp(16px, 4vw, 44px) 60px; max-width: 1100px; width: 100%; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.cabecera p { color: var(--texto-2); margin: 0; }

@media (max-width: 820px) {
  .marco { grid-template-columns: 1fr; }
  .lateral {
    position: sticky; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; z-index: 20;
    border-right: 0; border-bottom: 1px solid var(--borde); overflow-x: auto;
  }
  .marca { padding: 0 8px 0 4px; }
  .marca small, .lateral .pie { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a span { display: none; }
  .nav a.activo span { display: inline; }
  .contenido { padding-top: 18px; }
}

/* ---- Componentes ---- */
.tarjeta {
  background: var(--fondo-2); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 18px 20px; box-shadow: var(--sombra);
}
.tarjeta + .tarjeta, .bloque + .bloque { margin-top: 16px; }
.tarjeta h2 { display: flex; align-items: center; gap: 8px; }
.tarjeta .ayuda { color: var(--texto-2); font-size: .9rem; margin-top: -.2em; }
.rejilla { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila.fin { justify-content: flex-end; }
.fila.entre { justify-content: space-between; }
.columna { display: flex; flex-direction: column; gap: 12px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .dos { grid-template-columns: 1fr; } }
.separador { height: 1px; background: var(--borde); margin: 16px 0; border: 0; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px;
  border-radius: var(--radio-s); border: 1px solid var(--borde); background: var(--fondo-2);
  font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.boton:hover { background: var(--fondo-3); }
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: .5; cursor: not-allowed; }
.boton.primario { background: var(--acento); border-color: var(--acento); color: var(--sobre-acento); }
.boton.primario:hover { background: var(--acento-2); border-color: var(--acento-2); }
.boton.peligro { color: var(--peligro); }
.boton.peligro:hover { background: var(--peligro-suave); border-color: var(--peligro); }
.boton.chico { padding: 5px 10px; font-size: .85rem; }
.boton.icono { padding: 7px; }
.boton svg { width: 16px; height: 16px; }

label.campo { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .88rem; }
label.campo > span.nota, .nota { font-weight: 400; color: var(--texto-3); font-size: .82rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--borde); border-radius: var(--radio-s);
  background: var(--fondo); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input[type="range"] { width: 100%; accent-color: var(--acento); }
input[type="checkbox"] { accent-color: var(--acento); width: 17px; height: 17px; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; cursor: pointer; }
label.check small { display: block; color: var(--texto-3); font-weight: 400; }

.segmentos { display: inline-flex; border: 1px solid var(--borde); border-radius: var(--radio-s); overflow: hidden; flex-wrap: wrap; }
.segmentos button { border: 0; background: transparent; padding: 7px 13px; cursor: pointer; font-weight: 550; color: var(--texto-2); }
.segmentos button + button { border-left: 1px solid var(--borde); }
.segmentos button.activo { background: var(--acento-suave); color: var(--acento); }

.etiqueta {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem;
  font-weight: 650; background: var(--fondo-3); color: var(--texto-2); white-space: nowrap;
}
.etiqueta.ok { background: var(--ok-suave); color: var(--ok); }
.etiqueta.mal { background: var(--peligro-suave); color: var(--peligro); }
.etiqueta.acento { background: var(--acento-suave); color: var(--acento); }
.etiqueta.info { background: var(--info-suave); color: var(--info); }

.lista { display: flex; flex-direction: column; }
.lista > .item { padding: 12px 0; border-top: 1px solid var(--borde); }
.lista > .item:first-child { border-top: 0; }
.item .meta { color: var(--texto-3); font-size: .82rem; }
.vacio { color: var(--texto-3); text-align: center; padding: 26px 10px; }

.agente-tarjeta { cursor: pointer; transition: border-color .15s, transform .15s; }
.agente-tarjeta:hover { border-color: var(--acento); transform: translateY(-1px); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--acento-suave); color: var(--acento); font-weight: 750; font-size: 1.1rem;
}

/* ---- Hablar ---- */
.hablar { display: grid; grid-template-columns: 1fr; gap: 16px; }
.conversacion { display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 58vh; overflow-y: auto; padding: 4px 2px; }
.burbuja { max-width: 82%; padding: 11px 15px; border-radius: 16px; white-space: pre-wrap; }
.burbuja.yo { align-self: flex-end; background: var(--acento-suave); border-bottom-right-radius: 5px; }
.burbuja.ia { align-self: flex-start; background: var(--fondo-3); border-bottom-left-radius: 5px; }
.burbuja .quien { font-size: .75rem; font-weight: 700; color: var(--texto-3); margin-bottom: 3px; }
.burbuja .datos { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.burbuja.error { background: var(--peligro-suave); color: var(--peligro); }
.escribiendo::after { content: "▍"; animation: parpadeo 1s steps(1) infinite; color: var(--acento); }
@keyframes parpadeo { 50% { opacity: 0; } }

.microfono-zona { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 4px; }
.microfono {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--acento); color: var(--sobre-acento); box-shadow: 0 6px 24px color-mix(in srgb, var(--acento) 40%, transparent);
  transition: transform .15s, background .15s; touch-action: manipulation; user-select: none;
}
.microfono svg { width: 38px; height: 38px; }
.microfono:hover { transform: scale(1.04); }
.microfono.grabando { background: var(--peligro); animation: latido 1.3s ease-in-out infinite; }
.microfono.ocupado { background: var(--texto-3); }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--peligro) 45%, transparent); } 50% { box-shadow: 0 0 0 16px transparent; } }
.estado-voz { font-size: .9rem; color: var(--texto-2); min-height: 1.4em; text-align: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde); background: var(--fondo-2); padding: 6px 13px; border-radius: 99px; cursor: pointer;
  font-weight: 600; color: var(--texto-2);
}
.chip.activo { border-color: var(--acento); background: var(--acento-suave); color: var(--acento); }

/* ---- Acceso ---- */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.acceso .tarjeta { width: min(380px, 100%); padding: 28px; }
.acceso .marca { justify-content: center; padding-bottom: 22px; font-size: 1.2rem; }

/* ---- Avisos ---- */
#avisos { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.aviso {
  background: var(--texto); color: var(--fondo); padding: 11px 16px; border-radius: var(--radio-s); box-shadow: var(--sombra);
  font-weight: 550; max-width: 420px; animation: entra .2s ease-out;
}
.aviso.mal { background: var(--peligro); color: #fff; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

.secreto {
  font-family: var(--mono); background: var(--fondo-3); border: 1px dashed var(--acento); padding: 10px 12px;
  border-radius: var(--radio-s); word-break: break-all; user-select: all;
}
.qr { background: #fff; padding: 8px; border-radius: 10px; width: 200px; }
.qr svg { width: 100%; height: auto; display: block; }
audio { width: 100%; height: 36px; }
.turno { padding: 14px 0; border-top: 1px solid var(--borde); }
.turno:first-child { border-top: 0; }
.turno .texto { white-space: pre-wrap; }
details summary { cursor: pointer; color: var(--texto-2); font-weight: 600; }
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin-bottom: 18px; overflow-x: auto; }
.pestanas button {
  border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--texto-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.pestanas button.activo { color: var(--acento); border-bottom-color: var(--acento); }
.oculto { display: none !important; }
pre.codigo { background: var(--fondo-3); padding: 12px 14px; border-radius: var(--radio-s); overflow-x: auto; font-size: .82rem; margin: 0; }
