/* ═══════════════════════════════════════════════════════════
   NISTO AI · "Chatea con tus datos" — estilos de la vista
   Fuente visual de verdad: prototipo hifi "Nisto AI.dc.html".
   Recrea el shell (panel de sesiones + hilo + composer), la
   transparencia colapsable, las burbujas, el avatar isotipo, los
   hovers de los charts (que nisto-charts.js necesita por CSS
   externo), el colapso global del sidebar y las media queries móviles.
   Los hexes provienen del handoff (permitidos por el design guard:
   ninguno cae en la lista indigo/azul/violeta prohibida).
   ═══════════════════════════════════════════════════════════ */

/* ── Layout raíz de la vista ───────────────────────────────────────────── */
/* La vista ocupa el alto del viewport; el shell es un flex horizontal:
   panel de sesiones (244px) + main (hilo + composer). */
#view-nisto-ai {
  height: 100vh;
  display: flex;
  background: #fff;
  font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  color: #0E0E10;
  -webkit-font-smoothing: antialiased;
}

/* ── Panel de sesiones (izquierda) ─────────────────────────────────────── */
.nai-sessions {
  width: 244px;
  flex: none;
  background: #FBFBFA;
  border-right: 1px solid #EFEFED;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  min-height: 0;
}
.nai-newbtn {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid #E8E8E6; background: #fff; color: #0E0E10;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 11px; border-radius: 10px; cursor: pointer;
  margin-bottom: 6px; width: 100%; text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.nai-newbtn:hover { background: #F7F7F6; border-color: #DcdCd9; }
.nai-sidelink {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  font-size: 13px; color: #3C3D41; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left;
  font: inherit;
}
.nai-sidelink[disabled] { color: #B0B1B5; cursor: not-allowed; }
.nai-sesslabel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: #B0B1B5; margin: 16px 8px 8px;
}
.nai-search { position: relative; margin: 0 2px 8px; }
.nai-search svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.nai-search input {
  width: 100%; border: 1px solid #EEEEEC; background: #fff;
  border-radius: 8px; padding: 7px 9px 7px 29px;
  font: inherit; font-size: 12.5px; outline: none; color: #3C3D41;
}
.nai-search input:focus { border-color: #D7D7D4; }
.nai-sesslist { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; }
.nai-sess {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: background .12s ease;
  border: none; background: transparent; width: 100%; text-align: left; font: inherit;
}
.nai-sess:hover { background: #F1F1EF; }
.nai-sess.active { background: #EFEFED; }
.nai-sess .nai-sess-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: transparent; }
.nai-sess.active .nai-sess-dot { background: #FF6A45; }
.nai-sess .nai-sess-title {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 500; color: #3C3D41;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nai-sess.active .nai-sess-title { font-weight: 600; color: #0E0E10; }
.nai-sess .nai-sess-del {
  opacity: 0; flex: none; border: none; background: transparent; cursor: pointer;
  color: #A6A7AC; padding: 2px; border-radius: 5px; display: flex;
  transition: opacity .12s ease;
}
.nai-sess:hover .nai-sess-del { opacity: 1; }
.nai-sess .nai-sess-del:hover { background: #E4E4E2; color: #3C3D41; }
.nai-sess-empty { padding: 10px 10px; font-size: 12.5px; color: #B0B1B5; line-height: 1.5; }
.nai-sessions-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 6px 2px; color: #B0B1B5; font-size: 12.5px;
}

/* ── Main (topbar + hilo + composer) ───────────────────────────────────── */
.nai-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; min-height: 0; }
.nai-topbar {
  flex: none; height: 54px; border-bottom: 1px solid #EFEFED;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
}
.nai-crumb { display: flex; align-items: center; gap: 9px; font-size: 13.5px; min-width: 0; }
.nai-crumb .nai-crumb-root { color: #9A9BA0; flex: none; }
.nai-crumb .nai-crumb-sep { color: #D2D3D6; flex: none; }
.nai-crumb .nai-crumb-cur { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nai-share {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid #E8E8E6; background: #fff; font: inherit;
  font-size: 12.5px; font-weight: 600; color: #3C3D41;
  padding: 6px 11px; border-radius: 9px; cursor: pointer;
}
.nai-share[disabled] { color: #B0B1B5; cursor: not-allowed; opacity: .7; }
.nai-share:not([disabled]):hover { background: #FAFAF9; border-color: #DcdCd9; }

/* Popover de compartir (bajo el botón Compartir) */
.nai-share-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 320px; background: #fff; border: 1px solid #E8E8E6;
  border-radius: 13px; box-shadow: 0 8px 28px rgba(16,16,18,.13);
  overflow: hidden;
}
.nai-share-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-bottom: 1px solid #F0F0EE;
  font-size: 13.5px; font-weight: 600; color: #0E0E10;
}
.nai-share-pop-body { padding: 14px 15px; font-size: 13px; color: #3C3D41; }
.nai-share-hint { margin: 0 0 11px; font-size: 12.5px; color: #76777C; line-height: 1.5; }
.nai-share-err { color: #B5531E; }
.nai-share-urlrow { display: flex; gap: 7px; align-items: center; }
.nai-share-url {
  flex: 1; min-width: 0; border: 1px solid #E8E8E6; border-radius: 8px;
  padding: 7px 9px; font-size: 12px; color: #3C3D41; background: #FBFBFA;
  font-family: 'JetBrains Mono', monospace;
}
.nai-share-copy {
  flex: none; border: none; background: #FF6A45; color: #fff; font: inherit;
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 8px; cursor: pointer;
}
.nai-share-copy:hover { background: #F0562F; }
.nai-share-disable {
  margin-top: 11px; width: 100%; border: 1px solid #E8E8E6; background: #fff;
  color: #76777C; font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 8px; border-radius: 8px; cursor: pointer;
}
.nai-share-disable:hover { background: #FAFAF9; color: #B5531E; border-color: #F0D9CF; }

/* Estado "sin datos" en la bienvenida */
.nai-empty-data {
  margin-top: 26px; display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 5px; padding: 26px 24px;
  border: 1px dashed #E2E2DF; border-radius: 14px; background: #FBFBFA; max-width: 420px;
}
.nai-empty-ic {
  width: 44px; height: 44px; border-radius: 12px; background: #F0F0EE;
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.nai-empty-title { margin: 0; font-size: 14.5px; font-weight: 600; color: #0E0E10; }
.nai-empty-sub { margin: 0; font-size: 12.5px; color: #76777C; line-height: 1.5; }
.nai-empty-cta {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 7px;
  border: none; background: #FF6A45; color: #fff; font: inherit;
  font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer;
}
.nai-empty-cta:hover { background: #F0562F; }

/* ── Hilo (scroll central) ─────────────────────────────────────────────── */
.nai-thread { flex: 1; overflow-y: auto; min-height: 0; }
.nai-thread-inner { max-width: 772px; margin: 0 auto; padding: 30px 26px 20px; }

/* Burbuja del usuario (derecha) */
.nai-user {
  display: flex; justify-content: flex-end; margin-bottom: 26px;
}
.nai-user > div {
  max-width: 78%; background: #F1F1EF; border-radius: 16px 16px 4px 16px;
  padding: 11px 15px; font-size: 14.5px; line-height: 1.5; color: #1A1A1C;
  white-space: pre-wrap; word-break: break-word;
}

/* Turno del asistente (avatar + contenido) */
.nai-assist { display: flex; gap: 13px; margin-bottom: 6px; animation: nis-rise .3s ease both; }
.nai-assist-body { flex: 1; min-width: 0; }
.nai-assist-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.nai-assist-name { font-size: 13.5px; font-weight: 600; }
.nai-assist-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #B7B8BC; }

/* Avatar isotipo squircle (gradiente coral + contraventana blanca) */
.nai-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex: none; margin-top: 2px;
  position: relative; background: linear-gradient(150deg, #FF7E5A, #FF5A38);
  box-shadow: 0 0 0 3px #fff, 0 2px 9px -2px rgba(216, 67, 31, .5);
}
.nai-avatar::after {
  content: ''; position: absolute; inset: 29%;
  border: 2px solid #fff; border-radius: 3px;
}
.nai-avatar.nai-avatar-lg { width: 56px; height: 56px; border-radius: 14px; margin: 0 0 20px; box-shadow: 0 0 0 4px #fff, 0 8px 22px -6px rgba(216, 67, 31, .55); }
.nai-avatar.nai-avatar-lg::after { border-width: 3.4px; border-radius: 6px; }
/* animación orb mientras stremea */
.nai-avatar.nai-orb { animation: nai-orb 6s ease-in-out infinite; }
@keyframes nai-orb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Prosa (markdown saneado) */
.nai-prose { font-size: 14.5px; line-height: 1.65; color: #1A1A1C; }
.nai-prose p { margin: 0 0 12px; }
.nai-prose p:last-child { margin-bottom: 0; }
.nai-prose ul, .nai-prose ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.nai-prose li { line-height: 1.55; }
.nai-prose b, .nai-prose strong { font-weight: 600; }
.nai-prose code { font-family: 'JetBrains Mono', monospace; font-size: .9em; background: #F1F1EF; padding: 1px 5px; border-radius: 5px; }
.nai-prose h1, .nai-prose h2, .nai-prose h3 { font-weight: 600; letter-spacing: -0.3px; margin: 4px 0 8px; }
.nai-prose a { color: #C2451F; text-decoration: underline; }
.nai-seg { margin-bottom: 16px; }

/* Cursor de streaming parpadeante */
.nai-cursor {
  display: inline-block; width: 2px; height: 1.05em; vertical-align: text-bottom;
  background: #FF6A45; margin-left: 2px; border-radius: 1px;
  animation: nai-blink 1s step-end infinite;
}
@keyframes nai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Indicador de estado "Thinking…" / "Consultando…" */
.nai-status { display: flex; align-items: center; gap: 8px; color: #76777C; font-size: 13.5px; margin-bottom: 6px; }
.nai-status .nai-status-dots { display: inline-flex; gap: 3px; }
.nai-status .nai-status-dots span {
  width: 5px; height: 5px; border-radius: 50%; background: #A6A7AC;
  animation: nis-blink 1.2s infinite;
}
.nai-status .nai-status-dots span:nth-child(2) { animation-delay: .2s; }
.nai-status .nai-status-dots span:nth-child(3) { animation-delay: .4s; }

/* ── Transparencia (tool_call colapsable) ──────────────────────────────── */
.nai-tool { border: 1px solid #EAEAE8; border-radius: 12px; overflow: hidden; margin-bottom: 16px; transition: border-color .12s ease; background: #FBFBFA; }
.nai-tool:hover { border-color: #D7D7D4; }
.nai-tool.nai-tool-error { border-color: #F2C9C4; }
.nai-tool-btn {
  width: 100%; text-align: left; background: #FBFBFA; border: none;
  padding: 10px 13px; cursor: pointer; font: inherit;
  display: flex; align-items: center; gap: 11px;
}
.nai-tool-ic {
  width: 26px; height: 26px; border-radius: 7px; background: #EDEBFA;
  display: inline-flex; align-items: center; justify-content: center; flex: none; color: #6B5BD2;
}
.nai-tool.nai-tool-error .nai-tool-ic { background: #FBEBE9; color: #C0392B; }
.nai-tool-txt { flex: 1; min-width: 0; }
.nai-tool-title { display: block; font-size: 13px; font-weight: 600; color: #1A1A1C; }
.nai-tool-title .nai-mono { font-family: 'JetBrains Mono', monospace; }
.nai-tool-meta { display: block; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: #A6A7AC; margin-top: 2px; }
.nai-tool-chev { color: #A6A7AC; flex: none; transition: transform .15s ease; display: flex; }
.nai-tool.open .nai-tool-chev { transform: rotate(180deg); }
.nai-tool-body { border-top: 1px solid #F0F0EE; padding: 13px; }
/* Banner de fuente (violeta claro del handoff) */
.nai-source {
  display: flex; align-items: center; gap: 8px;
  background: #F3F1FB; border: 1px solid #E4E0F5; border-radius: 9px;
  padding: 8px 11px; margin-bottom: 12px;
}
.nai-source svg { flex: none; }
.nai-source span { font-size: 12px; color: #4A3E82; }
.nai-steps { display: flex; flex-direction: column; gap: 8px; }
.nai-step { display: flex; gap: 9px; align-items: flex-start; }
.nai-step-check {
  width: 15px; height: 15px; border-radius: 50%; background: #ECF6F0;
  display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px;
}
.nai-step span:last-child { font-size: 12.5px; color: #5A5B60; line-height: 1.5; }
/* Bloque SQL oscuro */
.nai-sql {
  margin-top: 12px; background: #0E0E12; border-radius: 9px; padding: 12px 13px; overflow-x: auto;
}
.nai-sql code {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: #C9D1E3;
  white-space: pre; line-height: 1.7; display: block;
}

/* ── Follow-ups (chips) ────────────────────────────────────────────────── */
.nai-followups { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.nai-followc {
  border: 1px solid #E8E8E6; background: #fff; font: inherit;
  font-size: 12.5px; font-weight: 500; color: #3C3D41;
  padding: 8px 13px; border-radius: 99px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s ease, border-color .12s ease;
}
.nai-followc:hover { background: #F4F4F2; border-color: #DcdCd9; }
.nai-followc svg { flex: none; }

/* ── Meta del turno (trabajó Xm · copiar) ──────────────────────────────── */
.nai-meta { display: flex; align-items: center; gap: 14px; margin-top: 16px; color: #B0B1B5; }
.nai-meta-worked { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.nai-meta-cost { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.nai-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: #D2D3D6; }
.nai-iconb {
  width: 26px; height: 26px; border-radius: 7px; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  border: none; background: transparent; color: #B0B1B5;
  transition: background .12s ease, color .12s ease;
}
.nai-iconb:hover { background: #F1F1EF; color: #3C3D41; }

/* ── Burbuja de error + reintentar ─────────────────────────────────────── */
.nai-error {
  border: 1px solid #F2C9C4; background: #FBEBE9; border-radius: 12px;
  padding: 12px 14px; font-size: 13.5px; color: #C0392B;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.nai-error-retry {
  border: 1px solid #E7A9A2; background: #fff; color: #C0392B; font: inherit;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 8px; cursor: pointer;
}
.nai-error-retry:hover { background: #FDF3F1; }

/* ── Bienvenida (estado inicial) ───────────────────────────────────────── */
.nai-welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 40px; overflow-y: auto; min-height: 0;
}
.nai-welcome h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.6px; text-align: center; }
.nai-welcome .nai-welcome-sub { margin: 10px 0 0; font-size: 14.5px; color: #76777C; text-align: center; max-width: 470px; line-height: 1.6; }
.nai-tables { display: flex; align-items: center; gap: 9px; margin-top: 26px; flex-wrap: wrap; justify-content: center; max-width: 640px; }
.nai-tables-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: #B0B1B5; margin-right: 2px;
}
.nai-tablechip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid #E8E8E6; background: #FBFBFA; border-radius: 99px;
  padding: 6px 12px; font-size: 12.5px; color: #3C3D41;
}
.nai-tablechip svg { flex: none; }
.nai-tablechip .nai-mono { font-family: 'JetBrains Mono', monospace; }
/* Fuentes conectadas exponibles a Nisto (opt-in por fuente) */
.nai-sources { margin-top: 26px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.nai-sources-list { display: flex; flex-direction: column; gap: 6px; }
.nai-source-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #E8E8E6; background: #FBFBFA; border-radius: 12px; padding: 9px 12px;
}
.nai-source-ic { flex: none; color: #B0B1B5; }
.nai-source-name {
  flex: 1 1 auto; min-width: 0; font-size: 13px; color: #3C3D41;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nai-source-err { margin: 2px 0 0; font-size: 12px; color: #D9542F; }
/* Tarjetas de sugerencia (grid 2 col) */
.nai-suggest-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 30px; width: 100%; max-width: 640px;
}
.nai-card {
  text-align: left; border: 1px solid #E8E8E6; background: #fff;
  border-radius: 14px; padding: 15px 16px; cursor: pointer; font: inherit;
  transition: border-color .12s ease; display: flex; gap: 12px; align-items: flex-start;
}
.nai-card:hover { border-color: #DcdCd9; }
.nai-card-ic {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: #FBEEE9; color: #D8431F;
}
/* rotación suave de fondos por índice (canales) */
.nai-card:nth-child(4n+2) .nai-card-ic { background: #ECF6F0; color: #1A7A45; }
.nai-card:nth-child(4n+3) .nai-card-ic { background: #EAF1FB; color: #2A6FDB; }
.nai-card:nth-child(4n+4) .nai-card-ic { background: #EDEBFA; color: #6B5BD2; }
.nai-card-title { display: block; font-size: 13.5px; font-weight: 600; }
.nai-card-sub { display: block; font-size: 12px; color: #A6A7AC; margin-top: 3px; line-height: 1.45; }

/* ── Composer ──────────────────────────────────────────────────────────── */
.nai-composer-wrap {
  flex: none; padding: 0 26px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 32%);
}
.nai-composer-inner { max-width: 772px; margin: 0 auto; }
.nai-composer {
  border: 1px solid #E4E4E2; border-radius: 16px; background: #fff;
  box-shadow: 0 6px 22px -12px rgba(16, 16, 18, .22); padding: 12px 14px 10px;
}
.nai-ta {
  width: 100%; border: none; background: transparent; resize: none;
  font: inherit; font-size: 14px; line-height: 1.5; color: #1A1A1C;
  min-height: 24px; max-height: 160px; outline: none;
}
.nai-composer-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
/* medidor de contexto */
.nai-ctx { display: flex; align-items: center; gap: 7px; }
.nai-ctx-label { font-size: 11px; color: #A6A7AC; }
.nai-ctx-bar {
  width: 54px; height: 5px; border-radius: 99px; background: #EFEFED;
  overflow: hidden; display: inline-block;
}
.nai-ctx-fill { display: block; height: 100%; border-radius: 99px; transition: width .3s ease, background .3s ease; }
.nai-comp-mic {
  width: 34px; height: 34px; border: none; background: transparent; border-radius: 9px;
  cursor: pointer; color: #9A9BA0; display: flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.nai-comp-mic:hover { background: #F1F1EF; color: #3C3D41; }
.nai-comp-mic.rec { background: #FFEDE7; color: #C2451F; }
.nai-comp-send {
  width: 34px; height: 34px; border: none; background: #0E0E10; border-radius: 9px;
  cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .12s ease;
}
.nai-comp-send:hover { background: #000; }
.nai-comp-send[disabled] { background: #D9DADD; cursor: not-allowed; }
.nai-comp-send.stop { background: #C0392B; }

/* ── Modal expandir gráfico ────────────────────────────────────────────── */
.nai-modal {
  position: fixed; inset: 0; background: rgba(16, 16, 18, .32); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 40px;
  animation: nis-fade .16s ease both;
}
.nai-modal-card {
  width: 100%; max-width: 920px; background: #fff; border-radius: 16px;
  box-shadow: 0 30px 80px -30px rgba(16, 16, 18, .6); overflow: hidden;
  animation: nai-pop .18s ease both; max-height: 90vh; display: flex; flex-direction: column;
}
@keyframes nai-pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.nai-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #EFEFED; flex: none;
}
.nai-modal-title { font-size: 15px; font-weight: 600; }
.nai-modal-close {
  width: 32px; height: 32px; border: none; background: #F1F1EF; border-radius: 8px;
  cursor: pointer; color: #3C3D41; display: flex; align-items: center; justify-content: center;
}
.nai-modal-close:hover { background: #E4E4E2; }
.nai-modal-body { padding: 24px; overflow-y: auto; }

/* ═══════════════════════════════════════════════════════════
   HOVERS DE CHARTS — requeridos por nisto-charts.js (CSS externo).
   El SVG generado usa las clases .ndot/.nbar/.narc; los efectos
   viven acá porque el markup es un string inyectado por x-html.
   ═══════════════════════════════════════════════════════════ */
.nis-area .ndot { opacity: 0; transition: opacity .12s ease; }
.nis-area:hover .ndot { opacity: 1; }
.nbar { transition: fill .12s ease; }
.nbar:hover { fill: #D8431F; }
.narc { transition: opacity .12s ease; cursor: pointer; }
.narc:hover { opacity: .82; }
/* hover de tarjeta de dashboard */
.nis-dashboard { transition: border-color .12s ease; }
.nis-dashboard:hover { border-color: #DcdCd9; }
/* botones de acción de charts (expandir/png/csv) */
.nis-act:hover { background: #F1F1EF; }

/* OLD sidebar collapse CSS removed — now in nisto-nav.css */

/* ═══════════════════════════════════════════════════════════
   MOBILE (<768px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* El colapso del sidebar no aplica en móvil (sidebar oculto por
     nisto-mobile.css); reset defensivo del main. */
  #nisto-main.nav-railed { margin-left: 0 !important; }

  /* La vista ocupa el alto disponible menos el bottom nav */
  #view-nisto-ai {
    height: calc(100dvh - var(--mnav-h)) !important;
    flex-direction: column;
  }
  /* El panel de sesiones se convierte en bottom sheet (oculto por defecto) */
  .nai-sessions {
    position: fixed; left: 0; right: 0; bottom: var(--mnav-h);
    top: 12%; width: 100% !important; z-index: 70;
    border-right: 0; border-top-left-radius: 22px; border-top-right-radius: 22px;
    box-shadow: 0 -16px 40px -20px rgba(16, 16, 18, .4);
    transform: translateY(110%); transition: transform .24s ease;
  }
  .nai-sessions.nai-sheet-open { transform: translateY(0); }
  .nai-sheet-veil {
    position: fixed; inset: 0 0 var(--mnav-h) 0; z-index: 69;
    background: rgba(16, 16, 18, .28); animation: nis-fade .16s ease both;
  }
  .nai-sheet-handle {
    display: flex; justify-content: center; padding: 10px 0 4px; flex: none;
  }
  .nai-sheet-handle > span { width: 38px; height: 4px; border-radius: 99px; background: #D9DADD; }

  .nai-thread-inner { padding: 18px 14px 12px; }
  .nai-user > div { max-width: 85%; }
  .nai-composer-wrap { padding: 0 12px 10px; }
  .nai-welcome { padding: 20px 22px; }
  .nai-welcome h2 { font-size: 23px; }
  .nai-suggest-grid { grid-template-columns: 1fr; }
  .nai-modal { padding: 0; align-items: flex-end; }
  .nai-modal-card {
    max-width: 100%; border-radius: 22px 22px 0 0; max-height: 88dvh;
  }

  /* Dashboard a 1 columna: los grids inline de nisto-charts.js
     (grid-template-columns por style="") se vencen con !important. */
  #view-nisto-ai .nis-half-grid { grid-template-columns: 1fr !important; }
  /* KPIs: de 4 a 2 columnas en móvil */
  #view-nisto-ai .nis-kpis { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Sesiones ocultas por defecto en móvil también cuando el veil no está;
   el handle solo aparece en el sheet móvil. */
@media (min-width: 769px) {
  .nai-sheet-handle, .nai-sheet-veil { display: none !important; }
}
