/* Mimir · estilos (misma paleta de marca Toshiba que KDB y Bifrost, sin dependencias externas) */

:root {
  /* Marca */
  --toshiba-rojo: #E61E1E;
  --rojo: #E61E1E;
  --rojo-osc: #C8161B;          /* texto/hover: contraste AA sobre blanco */
  --rojo-suave: #FDECEC;
  --negro: #000;
  /* Neutros */
  --fondo: #E9EAED;
  --panel: #F8F8F9;
  --panel-2: #F0F1F3;
  --borde: #D7D8DC;
  --borde-fuerte: #BDBEC4;
  --texto: #18181A;
  --texto-2: #505054;           /* Dark Gray */
  --texto-3: #6E6E74;
  --gris-marca: #A0A0A5;        /* Toshiba Gray: solo decorativo */
  --gris-suave: #E4E5E8;
  /* Secundarios (tono oscuro para texto, tinte claro para fondo) */
  --azul: #265C80;              /* Dark Cyan */
  --azul-suave: #E3EFF9;
  --verde: #007580;             /* Dark Teal */
  --verde-suave: #E3F4F4;
  --ambar: #B94800;             /* Dark Orange */
  --ambar-suave: #FEF1E3;
  --violeta: #644080;           /* Dark Lavender */
  --violeta-suave: #F0EAF5;
  /* Forma */
  --radio: 12px;
  --radio-s: 8px;
  --radio-xs: 4px;
  --sombra: 0 1px 2px rgba(16, 16, 20, .04), 0 1px 3px rgba(16, 16, 20, .06);
  --sombra-alta: 0 10px 30px -12px rgba(16, 16, 20, .25);
  --anillo: 0 0 0 3px rgba(230, 30, 30, .18);
  --fuente: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
  --ancho-lateral: 264px;
  --cruces: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cpath d='M11 6v10M6 11h10' stroke='%23A0A0A5' stroke-width='1.2'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Modo oscuro automático (según el sistema), salvo que el usuario haya elegido «claro» */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rojo: #F24A4A;
    --rojo-osc: #FF7070;
    --rojo-suave: #563134;
    --fondo: #2B2D32;
    --panel: #34373D;
    --panel-2: #3B3E45;
    --borde: #4B4E56;
    --borde-fuerte: #5E616A;
    --texto: #F0F0F2;
    --texto-2: #CBCCD2;
    --texto-3: #A8AAB1;
    --gris-suave: #42454C;
    --azul: #8CC0EC;
    --azul-suave: #2D4559;
    --verde: #6CCFCF;
    --verde-suave: #284848;
    --ambar: #F7A64A;
    --ambar-suave: #53412B;
    --violeta: #C2A6DA;
    --violeta-suave: #473B58;
    --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
    --sombra-alta: 0 10px 30px -12px rgba(0, 0, 0, .8);
    --anillo: 0 0 0 3px rgba(240, 58, 58, .3);
    --cruces: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cpath d='M11 6v10M6 11h10' stroke='%236A6B72' stroke-width='1.2'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

/* Modo oscuro elegido por el usuario en su perfil (independiente del sistema operativo) */
:root[data-theme="dark"] {
  --rojo: #F24A4A;
  --rojo-osc: #FF7070;
  --rojo-suave: #563134;
  --fondo: #2B2D32;
  --panel: #34373D;
  --panel-2: #3B3E45;
  --borde: #4B4E56;
  --borde-fuerte: #5E616A;
  --texto: #F0F0F2;
  --texto-2: #CBCCD2;
  --texto-3: #A8AAB1;
  --gris-suave: #42454C;
  --azul: #8CC0EC;
  --azul-suave: #2D4559;
  --verde: #6CCFCF;
  --verde-suave: #284848;
  --ambar: #F7A64A;
  --ambar-suave: #53412B;
  --violeta: #C2A6DA;
  --violeta-suave: #473B58;
  --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
  --sombra-alta: 0 10px 30px -12px rgba(0, 0, 0, .8);
  --anillo: 0 0 0 3px rgba(240, 58, 58, .3);
  --cruces: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cpath d='M11 6v10M6 11h10' stroke='%236A6B72' stroke-width='1.2'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* Logotipo: rojo en claro, blanco en oscuro (la marca prohíbe el rojo sobre negro) */
.logo-oscuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-claro { display: none; }
  :root:not([data-theme="light"]) .logo-oscuro { display: block; }
}
:root[data-theme="dark"] .logo-claro { display: none; }
:root[data-theme="dark"] .logo-oscuro { display: block; }


/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 15px/1.55 var(--fuente); -webkit-font-smoothing: antialiased; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
button, input, textarea, select { font: inherit; color: inherit; }
.ico { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.muted { color: var(--texto-3); }
.small { font-size: .8rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.logo-oscuro { display: none; }
img.logo-oscuro { display: none; }
@media (prefers-color-scheme: dark) { img.logo-claro { display: none; } img.logo-oscuro { display: block; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 34px; padding: .4rem .9rem;
  border-radius: var(--radio-s); border: 1px solid var(--borde-fuerte); background: var(--panel); color: var(--texto);
  font-weight: 700; font-size: .84rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--gris-suave); text-decoration: none; }
.btn-primario { background: var(--toshiba-rojo); border-color: var(--toshiba-rojo); color: #fff; }
.btn-primario:hover { background: #C8161B; }
.btn-bloque { width: 100%; }
.btn-icono { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: none; border-radius: var(--radio-xs);
  color: var(--texto-3); cursor: pointer; }
.btn-icono:hover { background: var(--gris-suave); color: var(--texto); }
input[type=email], input[type=password], input[type=text], textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--borde-fuerte);
  border-radius: var(--radio-s); background: var(--panel); min-height: 40px; }
input:focus, textarea:focus { outline: none; border-color: var(--rojo); box-shadow: var(--anillo); }
label { display: block; font-weight: 700; font-size: .82rem; margin: 0 0 .3rem; }
.aviso { border-radius: var(--radio-s); padding: .7rem .9rem; margin-bottom: 1rem; border: 1px solid var(--borde); background: var(--panel); font-size: .88rem; }
.aviso-error { border-color: var(--rojo); background: var(--rojo-suave); color: var(--rojo-osc); }

/* ---------- Marca ---------- */
.marca { display: block; color: var(--texto); }
.marca img { height: 18px; width: auto; }
.marca-texto { display: flex; align-items: center; gap: .45rem; margin-top: .5rem; font-size: .66rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--texto-2); }
.marca-texto::before { content: ""; width: 8px; height: 8px; background: var(--rojo); transform: rotate(24deg); }

/* ---------- Páginas de acceso: panel de marca + formulario ---------- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 1fr) minmax(0, 560px); background: var(--panel); }
.acceso-marca { position: relative; overflow: hidden; background: #111113; color: #fff; padding: 3rem; display: flex;
  flex-direction: column; justify-content: space-between; }
.acceso-marca::before { content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Cpath d='M13 8v10M8 13h10' stroke='%23505054' stroke-width='1.2'/%3E%3C/svg%3E");
  opacity: .55; -webkit-mask-image: linear-gradient(135deg, #000 10%, transparent 70%); mask-image: linear-gradient(135deg, #000 10%, transparent 70%); }
.acceso-marca > * { position: relative; }
.acceso-marca .logo { height: 26px; width: auto; display: block; align-self: flex-start; }
.acceso-marca .eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #A0A0A5; margin: 0 0 .8rem; }
.acceso-marca h2 { font-size: clamp(1.8rem, 3.2vw, 2.7rem); line-height: 1.12; margin: 0; max-width: 15ch; letter-spacing: -.02em; }
.acceso-marca h2::after { content: ""; display: block; width: 64px; height: 4px; background: var(--toshiba-rojo); margin-top: 1.1rem; }
.acceso-marca .lema { color: #C9C9CE; max-width: 42ch; margin: 1.1rem 0 0; }
.acceso-marca .pie { font-size: .75rem; color: #8E8E95; }
.acceso-marca .forma { position: absolute; transform: rotate(24deg); }
.acceso-marca .f1 { width: 260px; height: 260px; background: var(--toshiba-rojo); right: -70px; bottom: -40px; }
.acceso-marca .f2 { width: 120px; height: 120px; border: 2px solid var(--toshiba-rojo); right: 190px; bottom: 210px; }
.acceso-marca .f3 { width: 44px; height: 44px; background: #fff; right: 120px; bottom: 300px; }
.acceso-panel { display: grid; place-items: center; padding: 2.5rem 1.5rem; background: var(--panel); }
.acceso-caja { width: 100%; max-width: 400px; }
.acceso-caja .marca { padding: 0 0 1.75rem; display: none; }
.acceso-caja .tarjeta { padding: 0; border: 0; box-shadow: none; background: transparent; }
.acceso-caja h1 { font-size: 1.6rem; }
.acceso-caja h1::after { content: ""; display: block; width: 48px; height: 3px; background: var(--rojo); margin-top: .6rem; margin-bottom: 1.4rem; }
.acceso-caja .btn-bloque { min-height: 44px; margin-top: .4rem; }
.acceso-enlaces { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .85rem;
  margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--borde); }
@media (max-width: 860px) {
  .acceso { grid-template-columns: 1fr; }
  .acceso-marca { display: none; }
  .acceso-caja .marca { display: block; }
  .acceso-panel { align-items: start; padding-top: 3rem; }
}

/* Pantalla de acceso: ilustración y referencia mitológica del nombre de la aplicación */
.acceso-marca .ilustracion { display: block; width: min(400px, 92%); height: auto; margin: 1.2rem auto 0; }
.acceso-marca .mito { font-size: .82rem; color: #A0A0A5; max-width: 46ch; margin: .9rem 0 0; font-style: italic; }
.acceso-marca h2 .nombre { display: block; font-size: .5em; letter-spacing: .02em; color: #C9C9CE; font-weight: 700; margin-top: .3rem; }
@media (max-width: 860px) { .acceso-marca .ilustracion { width: 220px; } }

.acceso-caja .ilustracion-movil { display: none; }
@media (max-width: 860px) { .acceso-caja .ilustracion-movil { display: block; width: 180px; height: auto; margin: 0 0 1rem;
  background: #111113; border-radius: 12px; padding: .6rem; } }

/* ---------- Chat ---------- */
.app { display: flex; height: 100%; }
.lateral { width: 260px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--borde); display: flex; flex-direction: column; }
.lateral-cabecera { padding: 1.1rem 1.1rem .8rem; }
.lateral .btn-bloque { margin: 0 1rem .6rem; width: calc(100% - 2rem); }
.historico { flex: 1; overflow-y: auto; padding: .2rem .6rem; }
.historico-titulo { font-size: .6rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--texto-3); margin: .6rem .5rem .3rem; }
.historico a { display: block; padding: .38rem .55rem; border-radius: var(--radio-s); color: var(--texto-2); font-size: .82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historico a:hover { background: var(--gris-suave); text-decoration: none; color: var(--texto); }
.historico a.activa { background: var(--rojo-suave); color: var(--rojo-osc); font-weight: 700; }
.historico .canal { font-size: .62rem; font-weight: 700; color: var(--texto-3); margin-left: .3rem; }
.lateral-pie { border-top: 1px solid var(--borde); padding: .7rem 1rem; font-size: .8rem; display: flex; align-items: center; gap: .5rem; }
.lateral-pie .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lateral-pie form { margin: 0; }
.enlace-boton { background: none; border: 0; padding: 0; color: var(--azul); cursor: pointer; font-size: .8rem; }

.principal { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.barra-movil { display: none; }
.mensajes { flex: 1; overflow-y: auto; padding: 1.5rem 1rem 1rem; }
.mensajes-interior { max-width: 820px; margin: 0 auto; }
.bienvenida { text-align: center; padding: 2.5rem 1rem 1rem; }
.bienvenida h1 { font-size: 1.6rem; }
.bienvenida p { color: var(--texto-2); max-width: 560px; margin: 0 auto 1.2rem; }
.sugerencias { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.sugerencias button { border: 1px solid var(--borde-fuerte); background: var(--panel); border-radius: 99px; padding: .4rem .85rem;
  font-size: .82rem; cursor: pointer; color: var(--texto-2); }
.sugerencias button:hover { border-color: var(--rojo); color: var(--texto); }
.msg { display: flex; gap: .7rem; margin-bottom: 1.2rem; }
.msg-avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.msg-user .msg-avatar { background: var(--texto); color: var(--panel); }
.msg-assistant .msg-avatar { background: var(--toshiba-rojo); color: #fff; }
.msg-cuerpo { min-width: 0; flex: 1; }
.msg-user .msg-texto { background: var(--gris-suave); border-radius: var(--radio-s); padding: .55rem .8rem; display: inline-block; white-space: pre-wrap; }
.msg-assistant .msg-texto { padding-top: .2rem; overflow-wrap: anywhere; }
.msg-texto p { margin: 0 0 .6rem; }
.msg-texto ol, .msg-texto ul { margin: 0 0 .6rem; padding-left: 1.3rem; }
.msg-texto li { margin-bottom: .2rem; }
.msg-texto code { font-family: var(--mono); font-size: .85em; background: var(--gris-suave); padding: .05rem .3rem; border-radius: 4px; }
.msg-texto .cita { font-size: .72rem; font-weight: 700; color: var(--azul); vertical-align: super; text-decoration: none; }
.msg-fuera .msg-texto { color: var(--texto-2); font-style: italic; }
.fuentes { margin-top: .4rem; display: flex; flex-direction: column; gap: .25rem; }
.fuente { font-size: .78rem; color: var(--texto-2); display: flex; gap: .4rem; align-items: baseline; }
.fuente b { color: var(--azul); }
.fuente .tipo { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 0 .3rem; border-radius: 4px;
  background: var(--gris-suave); color: var(--texto-3); }
.msg-pie { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; font-size: .72rem; color: var(--texto-3); }
.msg-pie .btn-icono { width: 24px; height: 24px; font-size: .85rem; }
.msg-pie .btn-icono.elegido { background: var(--azul-suave); color: var(--azul); }
.pensando { display: inline-flex; gap: 4px; padding: .5rem 0; }
.pensando span { width: 7px; height: 7px; border-radius: 50%; background: var(--texto-3); animation: pensando 1.2s infinite ease-in-out; }
.pensando span:nth-child(2) { animation-delay: .15s; } .pensando span:nth-child(3) { animation-delay: .3s; }
@keyframes pensando { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.estado-busqueda { font-size: .78rem; color: var(--texto-3); }

.redactar { border-top: 1px solid var(--borde); background: var(--panel); padding: .8rem 1rem 1rem; }
.redactar form { max-width: 820px; margin: 0 auto; display: flex; gap: .5rem; align-items: flex-end; }
.redactar textarea { resize: none; min-height: 44px; max-height: 200px; line-height: 1.45; }
.redactar .btn { min-height: 44px; }
.redactar .nota { max-width: 820px; margin: .4rem auto 0; font-size: .7rem; color: var(--texto-3); text-align: center; }

/* ---------- Estado (administradores) ---------- */
.pagina { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1rem; }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tabla th { text-align: left; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-3); padding: .4rem .5rem; border-bottom: 1px solid var(--borde); }
.tabla td { padding: .45rem .5rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.cifra { font-size: 1.6rem; font-weight: 700; }

@media (max-width: 800px) {
  .lateral { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sombra-alta); }
  .app.menu-abierto .lateral { transform: none; }
  .barra-movil { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--borde); background: var(--panel); }
  .app.menu-abierto .fondo-menu { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.45); }
}
.fondo-menu { display: none; }

.acceso-caja .campo { margin-bottom: .9rem; }
