/* Neurus Demo · estilos compartidos (alineados con iurco.ai) */
:root {
  --ink-900: #0c0c0d;
  --ink-800: #131314;
  --ink-700: #161617;
  --ink-600: #1c1c1c;
  --ink-500: #262626;
  --ink-400: #404040;
  --accent: #facc15;       /* mostaza · matchea iurco.ai */
  --accent-soft: #ca8a04;
  --accent-glow: #fde047;
  --accent-ink: #1c1917;   /* texto sobre fondo accent sólido */
  --warn: #fbbf24;
  --danger: #f87171;
  --display-font: 'Bricolage Grotesque', 'Space Grotesk', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #060606; }
body {
  background-color: var(--ink-900);
  color: #fafafa;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
  min-height: 100dvh;
}
::selection { background: var(--accent); color: var(--accent-ink); }

/* Display headings use Bricolage Grotesque (matches main site) */
.hero-client,
.app-bar-title .t1,
.kpi-card .val,
.prompt-section-header .t1,
.alert-card .ttl,
.tcard .t-val {
  font-family: var(--display-font);
  letter-spacing: -0.015em;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; -webkit-touch-callout: none; }

.app-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.app-scroll::-webkit-scrollbar-track { background: transparent; }
.app-scroll::-webkit-scrollbar-thumb { background: var(--ink-500); border-radius: 3px; }

/* ============ App shell (mobile-first → desktop 3-pane) ============ */
.shell {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topbar"
    "main";
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink-900);
}

/* Mobile top bar (hidden on desktop) */
.mobile-bar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 8px) 8px 8px;
  background: rgba(12,12,13,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-500);
  position: sticky; top: 0; z-index: 30;
}
.mobile-bar-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: #fafafa; }
.mobile-bar-btn:active { background: var(--ink-700); }
.mobile-bar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.mobile-bar-back { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--accent); }
.mobile-bar-title .mb-t1 { font-weight: 600; font-size: 13px; line-height: 1.1; }
.mobile-bar-title .mb-t2 { font-size: 10px; color: #999; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.mobile-bar-title .mb-t2 .dot { width: 5px; height: 5px; border-radius: 3px; background: var(--accent); animation: pulseDot 1.6s infinite; }

/* Sidebar + right panel = drawers on mobile, hidden by default */
.sidebar, .rightpanel {
  position: fixed; top: 0; bottom: 0; z-index: 90;
  background: var(--ink-800);
  width: min(320px, 86%);
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: transform 280ms cubic-bezier(0.16,1,0.3,1);
}
.sidebar     { left: 0;  border-right: 1px solid var(--ink-500); transform: translateX(-100%); }
.rightpanel  { right: 0; border-left:  1px solid var(--ink-500); transform: translateX(100%); }
.drawer.open, .sidebar.open, .rightpanel.open { transform: translateX(0); }
.drawer-backdrop, .rp-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease;
}
.drawer-backdrop.open, .rp-backdrop.open { opacity: 1; pointer-events: auto; }

.main-col {
  grid-area: main;
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;   /* permite que .chat-area shrinkee y haga scroll */
  background: var(--ink-900);
}

/* === Desktop ≥ 1024px: persistent 3-pane shell === */
@media (min-width: 1024px) {
  body { background: var(--ink-900); }
  .shell {
    grid-template-columns: 264px 1fr 296px;
    grid-template-rows: 1fr;
    grid-template-areas: "sidebar main rightpanel";
    height: 100vh; min-height: 100vh;
    overflow: hidden;
  }
  .mobile-bar { display: none; }
  .sidebar, .rightpanel {
    position: static; transform: none; width: auto; z-index: auto;
  }
  .sidebar    { grid-area: sidebar; }
  .rightpanel { grid-area: rightpanel; }
  .drawer, .drawer-backdrop, .rp-backdrop { display: none !important; }
}

/* Old drawer (mobile only sidebar dup) */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(320px, 86%); background: var(--ink-800);
  border-right: 1px solid var(--ink-500);
  z-index: 95;
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(0.16,1,0.3,1);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding-top: var(--safe-top);
}
@media (min-width: 1024px) { .drawer { display: none; } }

/* ============ Sidebar internals ============ */
.sb-back {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--ink-500);
  transition: background 150ms;
}
.sb-back:hover { background: var(--ink-700); }
.sb-back svg { width: 14px; height: 14px; }
@media (max-width: 1023px) { .sb-back { display: none; } }

.sb-section { padding: 18px 18px; border-bottom: 1px solid var(--ink-500); }
.sb-section.sb-nav { padding: 12px 10px; flex: 1; min-height: 0; overflow-y: auto; }
.sb-section.sb-footer { border-bottom: 0; margin-top: auto; }

.sb-brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(250,204,21,0.15); border: 1px solid rgba(250,204,21,0.40);
  display: flex; align-items: center; justify-content: center;
}
.sb-name { font-family: var(--display-font); font-weight: 500; font-size: 16px; letter-spacing: -0.015em; }
.sb-tag  { font: 500 9.5px 'JetBrains Mono', monospace; color: #888; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }

.sb-client { padding: 10px 12px; background: var(--ink-700); border: 1px solid var(--ink-500); border-radius: 10px; }
.sb-client-lbl { font: 600 9.5px 'JetBrains Mono', monospace; color: #888; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.sb-client-name { font-family: var(--display-font); font-weight: 500; font-size: 14px; letter-spacing: -0.01em; }
.sb-client-sub  { font-size: 11px; color: #888; margin-top: 2px; }

.sb-h { font: 600 9.5px 'JetBrains Mono', monospace; color: #777; text-transform: uppercase; letter-spacing: 0.10em; padding: 0 8px 8px; }
.sb-h-pad { padding-top: 18px; }

.sb-select {
  width: 100%; background: var(--ink-700); border: 1px solid var(--ink-500);
  border-radius: 8px; padding: 9px 11px; font-size: 13px; color: #fafafa;
  outline: none; transition: border-color 150ms;
}
.sb-select:focus { border-color: rgba(250,204,21,0.5); }

.sb-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 9px;
  font-size: 13px; color: #aaa;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.sb-nav-item:hover, .sb-nav-item:focus { background: var(--ink-700); color: #fafafa; }
.sb-nav-item.is-active {
  background: rgba(250,204,21,0.10);
  border: 1px solid rgba(250,204,21,0.22);
  color: #fafafa;
}
.sb-nav-item.is-action,
.sb-nav-recent.is-action,
.rp-alert.is-action { cursor: pointer; }
.rp-alert.is-action:hover { filter: brightness(1.2); }
.sb-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sb-pill { margin-left: auto; padding: 1px 6px; border-radius: 4px; font: 600 9px 'JetBrains Mono', monospace; background: rgba(250,204,21,0.20); color: var(--accent); }
.sb-pill-view { background: rgba(255,255,255,0.06); color: #999; }
.sb-nav-item.is-active .sb-pill-view { background: rgba(250,204,21,0.18); color: var(--accent); }

/* ============ View panes (catálogo, pedidos, marketing…) ============ */
.view-pane { padding: 4px 4px 24px; }
.view-head { margin-bottom: 20px; }
.view-head .view-eyebrow { font: 600 10px 'JetBrains Mono', monospace; color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 8px; }
.view-head .view-title { font-family: var(--display-font); font-weight: 500; font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; }
.view-head .view-sub { font-size: 13px; color: #888; margin-top: 6px; }
.view-kpis {
  display: grid; gap: 10px;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 24px;
}
@media (min-width: 720px) { .view-kpis { grid-template-columns: repeat(4, 1fr); } }
.view-kpi {
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--ink-500);
  background: var(--ink-800);
}
.view-kpi .vk-lbl { font: 600 9.5px 'JetBrains Mono', monospace; color: #888; text-transform: uppercase; letter-spacing: 0.10em; margin-bottom: 6px; }
.view-kpi .vk-val { font-family: var(--display-font); font-weight: 500; font-size: 22px; letter-spacing: -0.02em; line-height: 1; }
.view-kpi .vk-val .vk-u { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #888; font-weight: 400; margin-left: 4px; }
.view-kpi .vk-sub { font: 500 11px 'JetBrains Mono', monospace; color: var(--accent); margin-top: 6px; }
.view-kpi.is-warn   .vk-val { color: var(--warn); }
.view-kpi.is-danger .vk-val { color: var(--danger); }
.view-kpi.is-accent .vk-val { color: var(--accent); }

.view-section { margin-top: 24px; }
.view-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.view-section-title { font-family: var(--display-font); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }
.view-section-meta { font: 500 10px 'JetBrains Mono', monospace; color: #888; }

/* Tabla densa para catálogo / pedidos */
.view-table-wrap {
  border: 1px solid var(--ink-500);
  border-radius: 12px;
  background: var(--ink-800);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.view-table-wrap::-webkit-scrollbar { height: 6px; }
.view-table-wrap::-webkit-scrollbar-thumb { background: var(--ink-500); border-radius: 3px; }
.view-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
.view-table thead th {
  text-align: left; padding: 10px 12px;
  font: 600 9.5px 'JetBrains Mono', monospace; color: #888;
  text-transform: uppercase; letter-spacing: 0.10em;
  border-bottom: 1px solid var(--ink-500);
}
.view-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--ink-700);
  color: #ddd;
}
.view-table tbody tr:hover td { background: rgba(250,204,21,0.03); }
.view-table .mono { font-family: 'JetBrains Mono', monospace; }
.view-table .num  { font-family: 'JetBrains Mono', monospace; text-align: right; }
.view-pill {
  display: inline-block;
  padding: 2px 8px; border-radius: 5px;
  font: 600 10px 'JetBrains Mono', monospace; letter-spacing: 0.04em;
  border: 1px solid var(--ink-500); background: var(--ink-700); color: #ccc;
}
.view-pill.ok      { color: var(--accent); border-color: rgba(250,204,21,0.35); background: rgba(250,204,21,0.06); }
.view-pill.warn    { color: var(--warn);   border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.06); }
.view-pill.danger  { color: var(--danger); border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.06); }

/* Chart card */
.view-chart {
  background: var(--ink-800);
  border: 1px solid var(--ink-500);
  border-radius: 14px;
  padding: 16px 18px;
}
.view-chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.view-chart-head .ttl { font-family: var(--display-font); font-weight: 500; font-size: 14px; letter-spacing: -0.01em; }
.view-chart-head .meta { font: 500 10px 'JetBrains Mono', monospace; color: #888; }

.view-grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .view-grid-2 { grid-template-columns: 1fr 1fr; } }

/* Bars chart (conversion funnel) */
.view-funnel { display: flex; flex-direction: column; gap: 8px; }
.view-funnel-row {
  display: grid; grid-template-columns: 120px 1fr 80px;
  align-items: center; gap: 12px;
  font-size: 12px;
}
.view-funnel-bar { height: 24px; border-radius: 5px; background: var(--ink-700); position: relative; overflow: hidden; }
.view-funnel-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, transparent)); }
.view-funnel-row .num { text-align: right; font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.sb-live { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font: 600 9px 'JetBrains Mono', monospace; color: var(--accent); }
.sb-live .dot { width: 5px; height: 5px; border-radius: 3px; background: var(--accent); animation: pulseDot 1.6s infinite; }
.sb-nav-recent {
  display: block; padding: 7px 10px; margin: 0 0 1px;
  font-size: 11.5px; color: #888;
  border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: background 150ms, color 150ms;
}
.sb-nav-recent:hover { background: var(--ink-700); color: #ccc; }

.sb-privacy {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: rgba(250,204,21,0.04); border: 1px solid rgba(250,204,21,0.20);
  border-radius: 10px;
}
.sb-privacy-dot { width: 6px; height: 6px; border-radius: 3px; background: var(--accent); margin-top: 6px; animation: pulseDot 1.6s infinite; flex-shrink: 0; }
.sb-privacy-ttl { font: 600 11px 'Space Grotesk', sans-serif; color: var(--accent); }
.sb-privacy-sub { font-size: 10px; color: #888; margin-top: 2px; line-height: 1.4; }
.sb-meta { margin-top: 10px; display: flex; justify-content: space-between; font: 500 9.5px 'JetBrains Mono', monospace; color: #666; padding: 0 4px; }

/* ============ Main column ============ */
.main-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--ink-500);
  background: var(--ink-900);
  flex-shrink: 0;
}
.main-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.main-title { font-family: var(--display-font); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }
.main-sep { color: #555; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.main-role { font: 500 12px 'JetBrains Mono', monospace; color: #999; }
.main-top-right { display: flex; align-items: center; gap: 12px; }
.main-conn { display: none; }
@media (min-width: 1280px) {
  .main-conn {
    display: inline-flex; align-items: center; gap: 6px;
    font: 500 11px 'JetBrains Mono', monospace; color: #888;
  }
  .main-conn .dot { width: 6px; height: 6px; border-radius: 3px; background: var(--accent); animation: pulseDot 1.6s infinite; }
}
.main-btn {
  padding: 7px 13px; border-radius: 7px;
  border: 1px solid var(--ink-500); color: #aaa;
  font-size: 12px; font-weight: 500;
  background: transparent;
  transition: border-color 150ms, color 150ms, background 150ms;
}
.main-btn:hover { color: #fafafa; border-color: rgba(250,204,21,0.45); background: rgba(250,204,21,0.04); }

.chat-area {
  flex: 1; overflow-y: auto;
  padding: 32px 24px;
  -webkit-overflow-scrolling: touch;
}
.chat-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* Welcome (initial state) */
.welcome-block { padding: 16px 0; }
.welcome-hero { text-align: center; margin-bottom: 28px; }
.welcome-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(250,204,21,0.15); border: 1px solid rgba(250,204,21,0.42);
  margin-bottom: 16px;
}
.welcome-title { font-family: var(--display-font); font-weight: 500; font-size: clamp(22px,3vw,30px); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 8px; }
.welcome-sub { font-size: 14px; color: #888; max-width: 56ch; margin: 0 auto; line-height: 1.5; }
.welcome-prompts {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  margin-top: 8px;
}
@media (min-width: 720px) { .welcome-prompts { grid-template-columns: 1fr 1fr; gap: 12px; } }
.welcome-prompt {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--ink-500);
  background: var(--ink-800);
  transition: border-color 200ms, background 200ms, transform 200ms;
  cursor: pointer;
  width: 100%;
}
.welcome-prompt:hover {
  border-color: rgba(250,204,21,0.42);
  background: var(--ink-700);
  transform: translateY(-1px);
}
.welcome-prompt .wp-cat { font: 600 9.5px 'JetBrains Mono', monospace; color: var(--accent); text-transform: uppercase; letter-spacing: 0.10em; margin-bottom: 6px; }
.welcome-prompt .wp-ttl { font-weight: 500; font-size: 13.5px; line-height: 1.35; margin-bottom: 4px; }
.welcome-prompt .wp-hint { font-size: 11.5px; color: #888; line-height: 1.4; }
.welcome-footnote { margin-top: 28px; text-align: center; font: 500 11px 'JetBrains Mono', monospace; color: #666; letter-spacing: 0.06em; }

/* Composer */
.composer {
  border-top: 1px solid var(--ink-500);
  padding: 14px 24px calc(14px + var(--safe-bottom));
  background: var(--ink-900);
  flex-shrink: 0;
}
.composer-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ink-800); border: 1px solid var(--ink-500);
}
.composer-input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 13px; color: #fafafa; }
.composer-input::placeholder { color: #555; }
.composer-demo { font: 600 9.5px 'JetBrains Mono', monospace; color: #777; padding: 4px 8px; border-radius: 5px; background: var(--ink-700); white-space: nowrap; }
@media (max-width: 540px) { .composer-demo { display: none; } }
.composer-send {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.composer-foot { max-width: 760px; margin: 6px auto 0; display: flex; justify-content: space-between; font: 500 10px 'JetBrains Mono', monospace; color: #666; }
@media (max-width: 540px) { .composer-foot { display: none; } }

/* ============ Right panel ============ */
.rp-section { padding: 18px 18px; border-bottom: 1px solid var(--ink-500); }
.rp-section:last-child { border-bottom: 0; }
.rp-h { font: 600 9.5px 'JetBrains Mono', monospace; color: #777; text-transform: uppercase; letter-spacing: 0.10em; margin-bottom: 12px; }
.rp-kpis { display: flex; flex-direction: column; gap: 12px; }
.rp-kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rp-kpi-lbl { font-size: 11.5px; color: #aaa; }
.rp-kpi-val { font-family: var(--display-font); font-weight: 500; font-size: 14px; }
.rp-kpi-u   { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #888; font-weight: 400; }
.rp-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--ink-700); overflow: hidden; margin-top: 6px; }
.rp-bar > div { height: 100%; border-radius: 2px; background: var(--accent); }

.rp-alerts { display: flex; flex-direction: column; gap: 8px; }
.rp-alert {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(250,204,21,0.30);
  background: rgba(250,204,21,0.05);
}
.rp-alert.kind-warn   { border-color: rgba(251,191,36,0.30); background: rgba(251,191,36,0.05); }
.rp-alert.kind-warn   .dot { background: var(--warn); }
.rp-alert.kind-danger { border-color: rgba(248,113,113,0.30); background: rgba(248,113,113,0.05); }
.rp-alert.kind-danger .dot { background: var(--danger); }
.rp-alert.kind-accent { border-color: rgba(250,204,21,0.30); background: rgba(250,204,21,0.05); }
.rp-alert.kind-accent .dot { background: var(--accent); }
.rp-alert .dot { width: 6px; height: 6px; border-radius: 3px; margin-top: 5px; flex-shrink: 0; }
.rp-alert-ttl { font: 600 11.5px 'Space Grotesk', sans-serif; color: #fafafa; }
.rp-alert-ttl { font-weight: 600; font-size: 11.5px; }
.rp-alert.kind-warn   .rp-alert-ttl { color: var(--warn); }
.rp-alert.kind-danger .rp-alert-ttl { color: var(--danger); }
.rp-alert.kind-accent .rp-alert-ttl { color: var(--accent); }
.rp-alert-det { font-size: 10.5px; color: #888; line-height: 1.4; margin-top: 2px; }

.rp-locs { display: flex; flex-direction: column; gap: 0; }
.rp-loc {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--ink-700);
  font-size: 12px;
}
.rp-loc:last-of-type { border-bottom: 0; }
.rp-loc-name { color: #ccc; }
.rp-loc-val { font: 500 11px 'JetBrains Mono', monospace; color: var(--accent); }
.rp-loc-more {
  width: 100%; margin-top: 10px;
  font: 500 11px 'Space Grotesk', sans-serif;
  color: #888;
  background: transparent; border: 0;
  transition: color 150ms;
}
.rp-loc-more:hover { color: var(--accent); }

/* Bubble + typing (inline in chat-inner) */
.bubble-user {
  align-self: flex-end;
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px 18px 4px 18px;
  background: var(--ink-700);
  font-size: 13.5px;
  line-height: 1.4;
}
.bubble-assistant-wrap { display: flex; gap: 10px; align-items: flex-start; }
.bubble-assistant-wrap .avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: rgba(250,204,21,0.15); border: 1px solid rgba(250,204,21,0.42);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bubble-assistant {
  flex: 1; min-width: 0;
  padding: 14px 16px;
  border-radius: 14px 14px 14px 4px;
  background: linear-gradient(135deg, rgba(250,204,21,0.05), transparent);
  border: 1px solid rgba(250,204,21,0.18);
  font-size: 13.5px; line-height: 1.55;
  box-shadow: 0 0 40px -10px rgba(250,204,21,0.10);
}
.typing-bubble {
  padding: 12px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--ink-800); border: 1px solid var(--ink-500);
  display: inline-flex; gap: 5px;
}

/* Animaciones */
.fade-in { animation: fadeIn 380ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.typing-dot { animation: pulseDot 1.4s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulseDot { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.chart-line { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: drawLine 1.2s ease-out forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes pulseSoft { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

/* ============ App Bar ============ */
.app-bar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: saturate(150%) blur(20px);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  border-bottom: 1px solid var(--ink-500);
}
.app-bar-inner { height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.app-bar-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: #fafafa; transition: background 150ms ease; }
.app-bar-btn:active { background: var(--ink-700); }
.app-bar-title { flex: 1; min-width: 0; text-align: center; }
.app-bar-title .t1 { font-weight: 600; font-size: 14px; line-height: 1.1; }
.app-bar-title .t2 { font-size: 10px; color: #999; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em; margin-top: 2px; }

/* ============ Dashboard ============ */
.dashboard {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(24px + var(--safe-bottom));
}

.dash-section { margin-bottom: 20px; }
.dash-section-title {
  display: flex; align-items: center; justify-content: space-between;
  font: 600 11px 'JetBrains Mono', monospace;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 4px 10px;
}
.dash-section-title .live {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; color: var(--accent);
}
.dash-section-title .live::before {
  content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--accent);
  animation: pulseDot 1.6s ease-in-out infinite;
}

/* Hero del cliente */
.hero-card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
}
.hero-client { font-weight: 700; font-size: 18px; line-height: 1.15; }
.hero-sub { font-size: 12px; color: #aaa; margin-top: 2px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px;
  font: 500 10px 'JetBrains Mono', monospace;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.hero-tag::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); animation: pulseDot 1.6s ease-in-out infinite; }

/* KPI cards (grid 2x2) */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi-card {
  padding: 12px 14px;
  background: var(--ink-800); border: 1px solid var(--ink-500);
  border-radius: 14px;
  min-width: 0;
}
.kpi-card .lbl { font: 500 10px 'JetBrains Mono', monospace; color: #888; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.kpi-card .val { font-weight: 700; font-size: 20px; line-height: 1.05; }
.kpi-card .val .u { font-weight: 400; font-size: 11px; color: #888; margin-left: 2px; }
.kpi-card .progress { height: 4px; background: var(--ink-700); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.kpi-card .progress > div { height: 100%; border-radius: 2px; background: var(--accent); }

/* Alertas */
.alert-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 8px;
}
.alert-card.kind-warn   { background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.3); }
.alert-card.kind-danger { background: rgba(248, 113, 113, 0.06); border: 1px solid rgba(248, 113, 113, 0.3); }
.alert-card.kind-accent { background: rgba(34, 197, 94, 0.06); border: 1px solid rgba(34, 197, 94, 0.3); }
.alert-card .dot { width: 6px; height: 6px; border-radius: 3px; margin-top: 6px; flex-shrink: 0; animation: pulseSoft 2s ease-in-out infinite; }
.alert-card.kind-warn   .dot { background: var(--warn); }
.alert-card.kind-danger .dot { background: var(--danger); }
.alert-card.kind-accent .dot { background: var(--accent); }
.alert-card .ttl { font-weight: 600; font-size: 13px; }
.alert-card.kind-warn   .ttl { color: var(--warn); }
.alert-card.kind-danger .ttl { color: var(--danger); }
.alert-card.kind-accent .ttl { color: var(--accent); }
.alert-card .det { font-size: 11px; color: #aaa; margin-top: 2px; line-height: 1.4; }
.alert-card .chev { color: #555; margin-left: auto; flex-shrink: 0; align-self: center; }

/* Lista de prompts (Neurus assistant) */
.prompt-section {
  background: var(--ink-800);
  border: 1px solid var(--ink-500);
  border-radius: 20px;
  padding: 16px 12px 12px;
  margin: 8px 0 12px;
}
.prompt-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--ink-700);
  margin-bottom: 8px;
}
.prompt-section-header .nlogo {
  width: 36px; height: 36px; border-radius: 12px;
  background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.4);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.prompt-section-header .t1 { font-weight: 600; font-size: 14px; line-height: 1.1; }
.prompt-section-header .t2 { font: 500 10px 'JetBrains Mono', monospace; color: #888; margin-top: 2px; }
.prompt-card {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px;
  border-radius: 12px;
  transition: background 150ms ease;
}
.prompt-card:active { background: var(--ink-700); }
.prompt-card + .prompt-card { border-top: 1px solid var(--ink-700); }
.prompt-card .pc-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--ink-700); border: 1px solid var(--ink-500);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.prompt-card .pc-body { flex: 1; min-width: 0; }
.prompt-card .pc-cat { font: 600 9px 'JetBrains Mono', monospace; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.prompt-card .pc-ttl { font-weight: 500; font-size: 13px; margin-top: 2px; line-height: 1.3; }
.prompt-card .pc-hint { font-size: 11px; color: #888; margin-top: 2px; line-height: 1.35; }
.prompt-card .pc-chev { color: #555; flex-shrink: 0; }

/* Lista de ubicaciones */
.loc-list { background: var(--ink-800); border: 1px solid var(--ink-500); border-radius: 14px; overflow: hidden; }
.loc-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.loc-row + .loc-row { border-top: 1px solid var(--ink-700); }
.loc-row .lname { font-size: 13px; color: #ddd; }
.loc-row .lval  { font: 500 12px 'JetBrains Mono', monospace; color: var(--accent); }

/* Strip horizontal scroll (para shortcuts) */
.h-strip {
  display: flex; gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px 4px;
}
.h-strip::-webkit-scrollbar { display: none; }
.h-strip > * { flex-shrink: 0; }

/* ============ Drawer ============ */
.drawer-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6);
  z-index: 80; opacity: 0; pointer-events: none; transition: opacity 220ms ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: min(320px, 86%); background: var(--ink-800);
  border-right: 1px solid var(--ink-500);
  z-index: 90;
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
  padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
@media (max-width: 719px) {
  .drawer-backdrop, .drawer { position: fixed; }
}

/* ============ Chat overlay (full screen sobre dashboard) ============ */
.chat-overlay {
  position: absolute; inset: 0;
  z-index: 50;
  display: flex; flex-direction: column;
  background: var(--ink-900);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: inherit; /* sigue el border del phone-frame */
  overflow: hidden;
}
.chat-overlay.open { transform: translateY(0); }
@media (max-width: 719px) {
  .chat-overlay { position: fixed; border-radius: 0; }
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(72px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 12px;
}

/* (old bubble overrides removed — new defs live in shell section above) */

/* Chat status bar (model meta) */
.chat-status {
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(10, 10, 10, 0.96) 60%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--ink-500);
}
.chat-status-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px;
  background: var(--ink-800); border: 1px solid var(--ink-500);
  border-radius: 16px;
  font: 500 10px 'JetBrains Mono', monospace;
  color: #888;
}
.chat-status-inner .dot { display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); margin-right: 6px; animation: pulseDot 1.6s infinite; }

/* ===================================================================
   MODO NASA · estilos extendidos para verticales con telemetría rica
   =================================================================== */

/* Fondo radar sutil — aplicado como background del frame, NO como overlay */
.nasa-bg {
  background-color: var(--ink-900);
  background-image:
    radial-gradient(circle at 30% 20%, rgba(34, 197, 94, 0.06), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(34, 197, 94, 0.04), transparent 40%),
    linear-gradient(rgba(34, 197, 94, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* Mission control bar (terminal estilo) */
.mission-bar {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.04), rgba(34, 197, 94, 0));
  border-bottom: 1px solid rgba(34, 197, 94, 0.25);
  font: 500 10px 'JetBrains Mono', monospace;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.mission-bar::-webkit-scrollbar { display: none; }
.mission-bar .mb-item { display: inline-flex; align-items: center; gap: 6px; color: #888; }
.mission-bar .mb-item strong { color: var(--accent); font-weight: 600; }
.mission-bar .mb-item.warn strong { color: var(--warn); }
.mission-bar .mb-item.live::before {
  content: ''; width: 5px; height: 5px; border-radius: 3px; background: var(--accent);
  animation: pulseDot 1.6s ease-in-out infinite;
}

/* Cards de telemetría (scroll horizontal) */
.telemetry-strip {
  display: flex; gap: 10px; overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 4px 16px 8px;
  scroll-snap-type: x mandatory;
}
.telemetry-strip::-webkit-scrollbar { display: none; }
.tcard {
  flex-shrink: 0;
  scroll-snap-align: start;
  width: 220px;
  padding: 14px;
  background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
  border: 1px solid var(--ink-500);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}
.tcard.glow {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 24px -8px rgba(34, 197, 94, 0.4);
}
.tcard::after {
  content: ''; position: absolute; top: 0; right: 0; width: 60px; height: 60px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.15), transparent 70%);
  pointer-events: none;
}
.tcard .t-lbl { font: 500 9px 'JetBrains Mono', monospace; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.tcard .t-val { font-weight: 700; font-size: 22px; line-height: 1; }
.tcard .t-val .t-u { font-weight: 400; font-size: 11px; color: #888; margin-left: 3px; }
.tcard .t-sub { font-size: 11px; color: #aaa; margin-top: 6px; line-height: 1.35; }
.tcard .spark { margin-top: 8px; }

/* Sparkline animada */
.spark svg { width: 100%; height: 24px; }
.spark path { stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-dasharray: 200; stroke-dashoffset: 200; animation: drawLine 1.2s ease-out forwards; }

/* Fuentes de datos (cards expandibles) */
.source-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  background: var(--ink-800); border: 1px solid var(--ink-500);
  border-radius: 12px;
  margin-bottom: 6px;
  transition: background 150ms ease;
}
.source-row:active { background: var(--ink-700); }
.source-row .s-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.source-row .s-body { flex: 1; min-width: 0; }
.source-row .s-name { font-size: 13px; font-weight: 500; line-height: 1.1; }
.source-row .s-meta { font: 500 10px 'JetBrains Mono', monospace; color: #888; margin-top: 3px; }
.source-row .s-status {
  display: flex; align-items: center; gap: 5px;
  font: 500 9px 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.source-row .s-status::before { content: ''; width: 6px; height: 6px; border-radius: 3px; }
.source-row .s-status.live   { color: var(--accent); }
.source-row .s-status.live::before   { background: var(--accent); animation: pulseDot 1.6s ease-in-out infinite; }
.source-row .s-status.sync   { color: var(--warn); }
.source-row .s-status.sync::before   { background: var(--warn); animation: pulseDot 1s ease-in-out infinite; }
.source-row .s-status.cache  { color: #888; }
.source-row .s-status.cache::before  { background: #888; }

/* Model card (la principal) */
.model-card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.02));
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 18px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.model-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(34, 197, 94, 0.18), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.model-card > * { position: relative; z-index: 1; }
.model-card .mc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.model-card .mc-id { font: 600 11px 'JetBrains Mono', monospace; color: var(--accent); }
.model-card .mc-stat { font-size: 10px; color: #aaa; margin-top: 2px; }
.model-card .mc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.model-card .mc-cell { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--ink-500); border-radius: 10px; padding: 10px; }
.model-card .mc-cell .l { font: 500 9px 'JetBrains Mono', monospace; color: #888; text-transform: uppercase; letter-spacing: 0.05em; }
.model-card .mc-cell .v { font-weight: 600; font-size: 14px; margin-top: 4px; }
.model-card .mc-cell .b { height: 3px; background: var(--ink-700); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.model-card .mc-cell .b > div { height: 100%; background: var(--accent); border-radius: 2px; transition: width 600ms ease; }

/* Thinking steps (en chat antes de la respuesta) */
.thinking-steps {
  background: var(--ink-800); border: 1px solid var(--ink-500);
  border-radius: 14px;
  padding: 12px 14px;
  font: 500 11px 'JetBrains Mono', monospace;
  color: #999;
}
.thinking-steps .ts-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  opacity: 0;
  animation: fadeIn 280ms ease-out forwards;
}
.thinking-steps .ts-row .tick {
  width: 14px; height: 14px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.thinking-steps .ts-row .tick.run {
  border: 1px solid var(--accent);
  animation: pulseSoft 1s ease-in-out infinite;
}
.thinking-steps .ts-row .tick.ok {
  background: var(--accent); color: var(--ink-900);
  font-weight: 700;
}
.thinking-steps .ts-row .tick.ok::after {
  content: '✓'; font-size: 9px;
}
.thinking-steps .ts-row .tk-time { margin-left: auto; color: #555; font-size: 10px; flex-shrink: 0; }
.thinking-steps .ts-row.run { color: #fff; }

/* Typewriter caret */
.tw-caret {
  display: inline-block; width: 7px; height: 14px;
  background: var(--accent); margin-left: 2px; vertical-align: -2px;
  animation: caretBlink 0.7s steps(2) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

/* Number ticker */
.ticker { display: inline-block; font-variant-numeric: tabular-nums; }

/* ==================================================
   Comparativa Cloud vs On-prem (durante el thinking)
   ================================================== */
.cloud-vs {
  margin-top: 10px;
  border-radius: 14px;
  background: var(--ink-800);
  border: 1px solid var(--ink-500);
  overflow: hidden;
}
.cloud-vs .cv-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-700);
  background: linear-gradient(90deg, rgba(248,113,113,0.04), rgba(34,197,94,0.04));
}
.cloud-vs .cv-head .ttl { font: 600 11px 'JetBrains Mono', monospace; color: #ddd; }
.cloud-vs .cv-head .meta { font: 500 10px 'JetBrains Mono', monospace; color: #888; }
.cloud-vs .cv-body { display: grid; grid-template-columns: 1fr 1fr; }
.cloud-vs .cv-col { padding: 12px 14px; }
.cloud-vs .cv-col + .cv-col { border-left: 1px solid var(--ink-700); }
.cloud-vs .cv-col .cv-hdr {
  display: flex; align-items: center; gap: 6px;
  font: 600 10px 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--ink-700);
}
.cloud-vs .cv-col.cloud .cv-hdr { color: var(--danger); }
.cloud-vs .cv-col.local .cv-hdr { color: var(--accent); }
.cloud-vs .cv-col .cv-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 3px 0;
  font-size: 11px;
}
.cloud-vs .cv-col .cv-row .l { color: #888; }
.cloud-vs .cv-col .cv-row .v {
  font: 600 12px 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.cloud-vs .cv-col.cloud .v { color: #f87171; }
.cloud-vs .cv-col.local  .v { color: var(--accent); }
.cloud-vs .cv-col .cv-row .v.flag { font-size: 10px; }
.cloud-vs .cv-col .cv-row.priv .v { font-size: 10px; }

.cv-footer {
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(34,197,94,0.05), rgba(34,197,94,0.02));
  border-top: 1px solid var(--ink-700);
  display: flex; justify-content: space-between; align-items: center;
  font: 500 11px 'JetBrains Mono', monospace;
  flex-wrap: wrap; gap: 6px;
}
.cv-footer .lbl { color: #888; }
.cv-footer .save { color: var(--accent); font-weight: 700; }
