/* =========================================================
   NEWSON INTRANET 4.0 · Capa visual "NextGen"
   Tipografía, asistente IA, búsqueda global, avisos y panel.
   Todos los componentes nuevos usan el prefijo .nx-
   ========================================================= */
:root {
  --nx-orange: #f5a000;
  --nx-orange-2: #ffb629;
  --nx-orange-600: #d98500;
  --nx-orange-50: #fff6e5;
  --nx-ink: #20262d;
  --nx-ink-2: #2b323a;
  --nx-ink-3: #3a424b;
  --nx-text: #242c35;
  --nx-muted: #697480;
  --nx-soft: #8b949e;
  --nx-line: rgba(55, 64, 73, .12);
  --nx-line-strong: rgba(55, 64, 73, .22);
  --nx-surface: #ffffff;
  --nx-surface-2: #f7f8f9;
  --nx-surface-3: #eef0f2;
  --nx-green: #2e7d32;
  --nx-red: #c62828;
  --nx-radius-sm: 10px;
  --nx-radius: 14px;
  --nx-radius-lg: 20px;
  --nx-shadow-sm: 0 4px 14px rgba(31, 38, 45, .06);
  --nx-shadow: 0 16px 40px rgba(31, 38, 45, .12);
  --nx-shadow-lg: 0 30px 80px rgba(20, 25, 31, .28);
  --nx-ease: cubic-bezier(.2, .8, .2, 1);
  --nx-font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --nx-mono: 'Cascadia Code', Consolas, 'SFMono-Regular', monospace;
}

/* ---------- Base y pulido general ---------- */
body.newson-app,
body.file-viewer-body,
body.newson-login-page {
  font-family: var(--nx-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.newson-app h1, body.newson-app h2, body.newson-app h3, body.newson-app h4,
body.newson-app .app-page-title, body.newson-app .dashboard-stat strong {
  font-family: var(--nx-font);
  letter-spacing: -.01em;
}
body.newson-app * { scrollbar-width: thin; scrollbar-color: rgba(83, 93, 104, .35) transparent; }
body.newson-app ::-webkit-scrollbar { width: 10px; height: 10px; }
body.newson-app ::-webkit-scrollbar-thumb { background: rgba(83, 93, 104, .28); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
body.newson-app ::-webkit-scrollbar-thumb:hover { background-color: rgba(83, 93, 104, .45); }
body.newson-app :focus-visible { outline: 3px solid rgba(245, 160, 0, .45) !important; outline-offset: 2px; }

body.newson-app .surface-card,
body.newson-app .module-launch-card,
body.newson-app .dashboard-stat {
  transition: transform .25s var(--nx-ease), box-shadow .25s var(--nx-ease), border-color .25s var(--nx-ease);
}
body.newson-app .module-launch-card:hover,
body.newson-app .dashboard-stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--nx-shadow) !important;
}

@media (prefers-reduced-motion: reduce) {
  body.newson-app *, body.newson-app *::before, body.newson-app *::after,
  .nx-assistant *, .nx-palette * { animation: none !important; transition: none !important; }
}

.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  font: 600 11px/1 var(--nx-font); color: var(--nx-muted);
  background: var(--nx-surface-2); border: 1px solid var(--nx-line-strong); border-bottom-width: 2px;
  border-radius: 6px; box-shadow: none;
}

/* ---------- Barra superior: búsqueda y campana ---------- */
.app-topbar-actions { gap: 10px; }
.nx-search-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; min-width: 260px; padding: 0 8px 0 14px;
  color: var(--nx-muted); font: 500 14px var(--nx-font);
  background: var(--nx-surface-2); border: 1px solid var(--nx-line); border-radius: 12px;
  cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s;
}
.nx-search-trigger, .nx-bell-wrap { flex: 0 0 auto; }
.nx-search-trigger span { flex: 1; text-align: left; }
.nx-search-trigger i { color: var(--nx-orange-600); }
.nx-search-trigger:hover { background: #fff; border-color: rgba(245, 160, 0, .45); box-shadow: 0 6px 18px rgba(245, 160, 0, .12); }

.nx-bell-wrap { position: relative; }
.nx-bell { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.nx-bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  display: inline-grid; place-items: center; font: 700 10px/1 var(--nx-font); color: #fff;
  background: #e53935; border: 2px solid #fff; border-radius: 999px;
  animation: nx-pop .35s var(--nx-ease);
}
.nx-bell-badge[hidden] { display: none; }
.nx-bell-menu {
  position: absolute; top: calc(100% + 12px); right: -8px; z-index: 1200;
  width: min(410px, calc(100vw - 24px));
  background: var(--nx-surface); border: 1px solid var(--nx-line); border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow-lg); overflow: hidden;
  animation: nx-drop .22s var(--nx-ease);
}
.nx-bell-menu[hidden] { display: none; }
.nx-bell-menu > header { padding: 16px 18px 12px; border-bottom: 1px solid var(--nx-line); background: linear-gradient(180deg, #fff, var(--nx-surface-2)); }
.nx-bell-menu > header strong { display: block; color: var(--nx-ink); font-size: 15px; }
.nx-bell-menu > header span { font-size: 12px; color: var(--nx-muted); }
.nx-bell-list { max-height: min(460px, 70vh); overflow-y: auto; padding: 6px; }
.nx-bell-item { display: flex; gap: 12px; padding: 12px; border-radius: 12px; transition: background .15s; }
.nx-bell-item:hover { background: var(--nx-surface-2); }
.nx-bell-item.is-new { background: var(--nx-orange-50); }
.nx-bell-copy { min-width: 0; flex: 1; }
.nx-bell-copy strong { display: block; margin: 3px 0 2px; font-size: 14px; color: var(--nx-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-bell-copy small { display: block; color: var(--nx-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-bell-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nx-bell-actions { display: flex; gap: 14px; margin-top: 6px; }
.nx-bell-actions a { font-size: 12px; font-weight: 700; color: var(--nx-orange-600) !important; }
.nx-bell-actions a:hover { text-decoration: underline; }
.nx-bell-empty { display: grid; justify-items: center; gap: 4px; padding: 32px 20px; text-align: center; color: var(--nx-muted); font-size: 13px; }
.nx-bell-empty i { font-size: 26px; color: var(--nx-soft); margin-bottom: 6px; }
.nx-bell-empty strong { color: var(--nx-ink); }
.nx-ticket { font: 700 11px var(--nx-mono); color: var(--nx-ink-3); letter-spacing: .02em; }
.nx-ticket i { color: var(--nx-orange); }
.nx-tag { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.nx-tag.is-new-doc { color: var(--nx-green); background: #e8f5e9; }
.nx-tag.is-updated { color: #9a5b00; background: #fff1d6; }

.nx-spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--nx-surface-3); border-top-color: var(--nx-orange); animation: nx-spin .8s linear infinite; }

/* ---------- Iconos por tipo de archivo ---------- */
.nx-result-icon {
  flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px; font-size: 17px;
  color: var(--nx-ink-3); background: var(--nx-surface-3);
}
.nx-result-icon.nx-ext-pdf { color: #d32f2f; background: #fdecea; }
.nx-result-icon.nx-ext-xls, .nx-result-icon.nx-ext-xlsx, .nx-result-icon.nx-ext-xlsm, .nx-result-icon.nx-ext-csv { color: #1b7f3b; background: #e7f5ec; }
.nx-result-icon.nx-ext-doc, .nx-result-icon.nx-ext-docx { color: #1f5fbf; background: #e8f0fc; }
.nx-result-icon.nx-ext-ppt, .nx-result-icon.nx-ext-pptx { color: #c4501b; background: #fdeee6; }
.nx-result-icon.nx-ext-jpg, .nx-result-icon.nx-ext-jpeg, .nx-result-icon.nx-ext-png, .nx-result-icon.nx-ext-webp { color: #7b3fb5; background: #f3ebfb; }
.nx-result-icon.is-module { color: var(--nx-orange-600); background: var(--nx-orange-50); }

/* ---------- Búsqueda global (Ctrl + K) ---------- */
.nx-palette { position: fixed; inset: 0; z-index: 3000; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.nx-palette[hidden] { display: none; }
.nx-palette-backdrop { position: absolute; inset: 0; background: rgba(20, 25, 31, .55); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
.nx-palette-dialog {
  position: relative; width: min(680px, 100%); max-height: 78vh; display: flex; flex-direction: column;
  background: var(--nx-surface); border-radius: var(--nx-radius-lg); box-shadow: var(--nx-shadow-lg); overflow: hidden;
  transform: translateY(-12px) scale(.98); opacity: 0; transition: transform .25s var(--nx-ease), opacity .2s;
}
.nx-palette.is-open .nx-palette-backdrop { opacity: 1; }
.nx-palette.is-open .nx-palette-dialog { transform: none; opacity: 1; }
body.nx-palette-open { overflow: hidden; }
.nx-palette-search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--nx-line); }
.nx-palette-search > i { color: var(--nx-orange-600); font-size: 18px; }
.nx-palette-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 17px var(--nx-font); color: var(--nx-ink); }
.nx-palette-search input::placeholder { color: var(--nx-soft); }
.nx-palette-search input:focus-visible { outline: none !important; }
.nx-palette-filters { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--nx-line); overflow-x: auto; }
.nx-filter {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  font: 600 12.5px var(--nx-font); color: var(--nx-muted); background: var(--nx-surface-2);
  border: 1px solid var(--nx-line); border-radius: 999px; cursor: pointer; transition: all .15s;
}
.nx-filter:hover { color: var(--nx-ink); border-color: var(--nx-line-strong); }
.nx-filter.is-active { color: var(--nx-ink); background: var(--nx-orange-50); border-color: rgba(245, 160, 0, .55); }
.nx-palette-results { flex: 1; overflow-y: auto; padding: 8px; transition: opacity .15s; }
.nx-palette-results.is-loading { opacity: .55; }
.nx-result-group { padding: 10px 10px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--nx-soft); }
.nx-result {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
  color: var(--nx-text) !important; text-decoration: none !important; scroll-margin: 8px;
}
.nx-result:hover, .nx-result.is-active { background: var(--nx-orange-50); }
.nx-result.is-active { box-shadow: inset 3px 0 0 var(--nx-orange); }
.nx-result-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nx-result-copy strong { font-size: 14px; color: var(--nx-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-result-copy small { font-size: 12px; color: var(--nx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-result-copy em { font-size: 12px; font-style: normal; color: var(--nx-ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx-result-go {
  flex: 0 0 auto; width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px;
  color: var(--nx-muted); transition: background .15s, color .15s;
}
.nx-result-go:hover { background: #fff; color: var(--nx-orange-600); box-shadow: var(--nx-shadow-sm); }
.nx-palette-empty { display: grid; justify-items: center; gap: 4px; padding: 40px 20px; color: var(--nx-muted); text-align: center; }
.nx-palette-empty i { font-size: 30px; color: var(--nx-soft); margin-bottom: 8px; }
.nx-palette-empty strong { color: var(--nx-ink); }
.nx-palette-footer {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--nx-line); background: var(--nx-surface-2); font-size: 12px; color: var(--nx-muted);
}
.nx-palette-footer kbd { margin-right: 3px; }
.nx-palette-ask {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px;
  font: 700 12.5px var(--nx-font); color: var(--nx-ink); cursor: pointer;
  background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); border: 0; border-radius: 10px;
}

/* ---------- Asistente IA ---------- */
.nx-assistant { position: fixed; right: 24px; bottom: 24px; z-index: 2500; font-family: var(--nx-font); }
.nx-assistant-fab {
  position: relative; display: inline-flex; align-items: center; gap: 10px; height: 58px; padding: 0 22px 0 8px;
  color: #fff; font: 700 14.5px var(--nx-font); cursor: pointer;
  background: linear-gradient(135deg, var(--nx-ink-3), var(--nx-ink)); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px; box-shadow: 0 16px 38px rgba(20, 25, 31, .35);
  transition: transform .25s var(--nx-ease), box-shadow .25s var(--nx-ease);
}
.nx-assistant-fab:hover { transform: translateY(-3px); box-shadow: 0 22px 48px rgba(20, 25, 31, .42); }
.nx-fab-icon {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%;
  color: var(--nx-ink); font-size: 19px; background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange));
}
.nx-fab-pulse { position: absolute; left: 8px; top: 7px; width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 0 rgba(245, 160, 0, .55); animation: nx-pulse 2.6s infinite; pointer-events: none; }
.nx-assistant.is-open .nx-assistant-fab { opacity: 0; pointer-events: none; transform: scale(.85); }

.nx-assistant-panel {
  position: absolute; right: 0; bottom: 0; width: 420px; height: min(680px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: var(--nx-surface);
  border: 1px solid var(--nx-line); border-radius: 22px; box-shadow: var(--nx-shadow-lg); overflow: hidden;
  transform-origin: bottom right; transform: translateY(16px) scale(.96); opacity: 0;
  transition: transform .28s var(--nx-ease), opacity .2s, width .3s var(--nx-ease), height .3s var(--nx-ease);
}
.nx-assistant-panel[hidden] { display: none; }
.nx-assistant.is-open .nx-assistant-panel { transform: none; opacity: 1; }
.nx-assistant.is-expanded .nx-assistant-panel { width: min(760px, calc(100vw - 48px)); height: calc(100vh - 110px); }

.nx-assistant-header {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 16px 14px 16px 18px;
  color: #fff; background: radial-gradient(circle at 90% -40%, rgba(245, 160, 0, .45), transparent 60%), linear-gradient(135deg, var(--nx-ink-2), var(--nx-ink));
}
.nx-assistant-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--nx-orange), var(--nx-orange-2), transparent); }
.nx-assistant-avatar {
  width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px;
  color: var(--nx-ink); font-size: 18px; background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange));
  box-shadow: 0 8px 20px rgba(245, 160, 0, .35);
}
.nx-assistant-heading { flex: 1; min-width: 0; }
.nx-assistant-heading h2 { margin: 0; font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.nx-assistant-heading p { margin: 2px 0 0; font-size: 12px; color: rgba(255, 255, 255, .72); display: flex; align-items: center; gap: 6px; }
.nx-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9e9e9e; }
.nx-status-dot.is-online { background: #4caf50; box-shadow: 0 0 0 3px rgba(76, 175, 80, .25); }
.nx-icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; display: inline-grid; place-items: center; border-radius: 10px;
  color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
  cursor: pointer; transition: background .15s, color .15s;
}
.nx-icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .16); }

.nx-assistant-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: linear-gradient(180deg, var(--nx-surface-2), #fff 140px); scroll-behavior: smooth; }
.nx-welcome { text-align: center; padding: 8px 6px 4px; animation: nx-fade .4s var(--nx-ease); }
.nx-welcome[hidden] { display: none; }
.nx-welcome-badge {
  width: 56px; height: 56px; margin: 4px auto 12px; display: grid; place-items: center; border-radius: 18px;
  color: var(--nx-orange-600); font-size: 22px; background: var(--nx-orange-50); border: 1px solid rgba(245, 160, 0, .25);
}
.nx-welcome h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; color: var(--nx-ink); }
.nx-welcome p { margin: 0 auto 14px; max-width: 330px; font-size: 13.5px; line-height: 1.55; color: var(--nx-muted); }
.nx-welcome-warning {
  margin: 0 0 14px; padding: 10px 12px; text-align: left; font-size: 12.5px; line-height: 1.5;
  color: #7a4a00; background: #fff4dc; border: 1px solid #ffe0a3; border-radius: 12px;
}
.nx-welcome-warning code { font: 600 11.5px var(--nx-mono); color: var(--nx-ink); background: rgba(255, 255, 255, .7); padding: 1px 5px; border-radius: 5px; }
.nx-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.nx-chip {
  padding: 8px 13px; font: 600 12.5px var(--nx-font); color: var(--nx-ink-3); cursor: pointer;
  background: #fff; border: 1px solid var(--nx-line-strong); border-radius: 999px;
  transition: all .18s var(--nx-ease);
}
.nx-chip:hover { color: var(--nx-ink); border-color: var(--nx-orange); background: var(--nx-orange-50); transform: translateY(-1px); }

.nx-msg { display: flex; flex-direction: column; margin: 0 0 14px; animation: nx-rise .28s var(--nx-ease); }
.nx-msg-user { align-items: flex-end; }
.nx-msg-assistant { align-items: flex-start; }
.nx-bubble { max-width: 88%; padding: 11px 14px; font-size: 14px; line-height: 1.6; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.nx-msg-user .nx-bubble { color: var(--nx-ink); background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); border-bottom-right-radius: 5px; white-space: pre-wrap; font-weight: 500; }
.nx-msg-assistant .nx-bubble { color: var(--nx-text); background: #fff; border: 1px solid var(--nx-line); border-bottom-left-radius: 5px; box-shadow: var(--nx-shadow-sm); }
.nx-msg.is-error .nx-bubble { color: #8a1c1c; background: #fdecea; border-color: #f5c2c0; }
.nx-bubble p { margin: 0 0 8px; }
.nx-bubble p:last-child, .nx-bubble ul:last-child, .nx-bubble ol:last-child { margin-bottom: 0; }
.nx-bubble h4 { margin: 10px 0 6px; font-size: 14.5px; font-weight: 800; color: var(--nx-ink); }
.nx-bubble h4:first-child { margin-top: 0; }
.nx-bubble ul, .nx-bubble ol { margin: 0 0 8px; padding-left: 20px; }
.nx-bubble li { margin: 3px 0; }
.nx-bubble li::marker { color: var(--nx-orange-600); }
.nx-bubble code { font: 12.5px var(--nx-mono); padding: 1px 5px; border-radius: 5px; background: var(--nx-surface-3); }
.nx-bubble blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--nx-orange); background: var(--nx-surface-2); border-radius: 0 8px 8px 0; color: var(--nx-ink-3); }
.nx-bubble hr { border: 0; border-top: 1px solid var(--nx-line); margin: 10px 0; }
.nx-bubble strong { color: var(--nx-ink); }
.nx-inline-link {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 0 6px; margin: 0 1px;
  color: #9a5b00 !important; font-weight: 700; text-decoration: none !important;
  background: var(--nx-orange-50); border-radius: 6px; border: 1px solid rgba(245, 160, 0, .28);
}
.nx-inline-link i { font-size: 11px; }
.nx-inline-link:hover { background: #ffe9bf; }

.nx-refs { display: grid; gap: 8px; width: 100%; max-width: 100%; margin-top: 8px; }
.nx-ref-card {
  display: flex; gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--nx-line);
  border-radius: 14px; box-shadow: var(--nx-shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.nx-ref-card:hover { border-color: rgba(245, 160, 0, .45); box-shadow: 0 10px 24px rgba(31, 38, 45, .09); }
.nx-ref-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; font-size: 17px; color: var(--nx-ink-3); background: var(--nx-surface-3); }
.nx-ref-pdf .nx-ref-icon { color: #d32f2f; background: #fdecea; }
.nx-ref-xls .nx-ref-icon, .nx-ref-xlsx .nx-ref-icon, .nx-ref-csv .nx-ref-icon { color: #1b7f3b; background: #e7f5ec; }
.nx-ref-doc .nx-ref-icon, .nx-ref-docx .nx-ref-icon { color: #1f5fbf; background: #e8f0fc; }
.nx-ref-ppt .nx-ref-icon, .nx-ref-pptx .nx-ref-icon { color: #c4501b; background: #fdeee6; }
.nx-ref-folder .nx-ref-icon { color: var(--nx-orange-600); background: var(--nx-orange-50); }
.nx-ref-body { min-width: 0; flex: 1; }
.nx-ref-name { display: block; font-size: 13.5px; color: var(--nx-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-ref-path { display: block; margin-top: 2px; font-size: 11.5px; color: var(--nx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-ref-path i { color: var(--nx-orange); }
.nx-ref-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.nx-ref-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  font: 700 12px var(--nx-font); color: var(--nx-ink-3) !important; text-decoration: none !important; cursor: pointer;
  background: var(--nx-surface-2); border: 1px solid var(--nx-line-strong); border-radius: 9px; transition: all .15s;
}
.nx-ref-btn:hover { color: var(--nx-ink) !important; border-color: var(--nx-orange); background: var(--nx-orange-50); }
.nx-ref-btn.is-primary { color: var(--nx-ink) !important; background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); border-color: transparent; }
.nx-ref-btn.is-primary:hover { filter: brightness(1.04); }

.nx-msg-tools { margin-top: 4px; opacity: 0; transition: opacity .15s; }
.nx-msg:hover .nx-msg-tools, .nx-msg-tools:focus-within { opacity: 1; }
.nx-mini-btn { padding: 3px 8px; font: 600 11.5px var(--nx-font); color: var(--nx-muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.nx-mini-btn:hover { color: var(--nx-ink); background: var(--nx-surface-3); }

.nx-typing .nx-bubble { display: inline-flex; align-items: center; gap: 10px; color: var(--nx-muted); font-size: 13px; }
.nx-dots { display: inline-flex; gap: 4px; }
.nx-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--nx-orange); animation: nx-bounce 1.2s infinite ease-in-out; }
.nx-dots i:nth-child(2) { animation-delay: .15s; }
.nx-dots i:nth-child(3) { animation-delay: .3s; }

.nx-assistant-form { display: flex; align-items: flex-end; gap: 8px; margin: 8px 12px 0; padding: 8px 8px 8px 14px; background: var(--nx-surface-2); border: 1px solid var(--nx-line-strong); border-radius: 16px; transition: border-color .2s, box-shadow .2s; }
.nx-assistant-form:focus-within { background: #fff; border-color: var(--nx-orange); box-shadow: 0 0 0 4px rgba(245, 160, 0, .14); }
.nx-assistant-form textarea {
  flex: 1; min-height: 24px; max-height: 140px; padding: 7px 0; resize: none; border: 0; outline: 0 !important;
  background: transparent; font: 500 14px/1.5 var(--nx-font); color: var(--nx-ink);
}
.nx-assistant-form textarea:focus-visible { outline: none !important; }
.nx-send-btn {
  width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 12px; cursor: pointer;
  color: var(--nx-ink); background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); transition: transform .15s, opacity .15s;
}
.nx-send-btn:hover:not(:disabled) { transform: scale(1.06); }
.nx-send-btn:disabled { opacity: .45; cursor: not-allowed; }
.nx-assistant.is-busy .nx-send-btn i { animation: nx-spin 1s linear infinite; }
.nx-assistant-disclaimer { margin: 6px 12px 10px; font-size: 11px; color: var(--nx-soft); text-align: center; }

/* ---------- Panel de inicio ---------- */
.nx-hero-content { max-width: 720px; }
.nx-hero-search {
  display: flex; align-items: center; gap: 10px; margin: 20px 0 18px; padding: 6px 6px 6px 18px; max-width: 600px;
  background: rgba(255, 255, 255, .96); border-radius: 16px; box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
}
.nx-hero-search > i { color: var(--nx-orange-600); font-size: 17px; }
.nx-hero-search input { flex: 1; min-width: 0; height: 44px; border: 0; outline: 0 !important; background: transparent; font: 500 15.5px var(--nx-font); color: var(--nx-ink); }
.nx-hero-search button {
  height: 44px; padding: 0 22px; border: 0; border-radius: 12px; cursor: pointer;
  font: 800 14px var(--nx-font); color: var(--nx-ink); background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange));
}
.nx-stat-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important; }
.nx-stat-text { font-size: 18px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
.dashboard-stat-copy { min-width: 0; }

.nx-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 22px; margin-bottom: 22px; align-items: start; }
.nx-dashboard-grid > .surface-card { margin-bottom: 0; }
.nx-side-stack { display: grid; gap: 22px; }
.nx-card .surface-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nx-title-icon { color: var(--nx-orange); margin-right: 4px; }
.nx-link-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--nx-orange-600) !important; border-radius: 10px; }
.nx-link-btn:hover { background: var(--nx-orange-50); text-decoration: none; }
.nx-doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; transition: background .15s; }
.nx-doc-row + .nx-doc-row { border-top: 1px solid var(--nx-line); }
.nx-doc-row:hover { background: var(--nx-surface-2); }
.nx-doc-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nx-doc-name { font-size: 14px; font-weight: 700; color: var(--nx-ink) !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-doc-name:hover { color: var(--nx-orange-600) !important; text-decoration: none; }
.nx-doc-meta { font-size: 12px; color: var(--nx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-doc-meta i { color: var(--nx-orange); }
.nx-doc-actions { display: flex; gap: 4px; opacity: .7; transition: opacity .15s; }
.nx-doc-row:hover .nx-doc-actions { opacity: 1; }
.nx-icon-link {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; cursor: pointer;
  color: var(--nx-muted) !important; background: transparent; border: 1px solid transparent; transition: all .15s;
}
.nx-icon-link:hover { color: var(--nx-orange-600) !important; background: #fff; border-color: var(--nx-line); box-shadow: var(--nx-shadow-sm); }
.nx-empty { display: grid; justify-items: center; gap: 4px; padding: 30px 16px; text-align: center; color: var(--nx-muted); font-size: 13.5px; }
.nx-empty i { font-size: 30px; color: var(--nx-soft); margin-bottom: 6px; }
.nx-empty strong { color: var(--nx-ink); font-size: 15px; }

.nx-ai-card {
  position: relative; overflow: hidden; padding: 24px; border-radius: var(--nx-radius-lg); color: #fff;
  background: linear-gradient(150deg, var(--nx-ink-3) 0%, var(--nx-ink) 70%); box-shadow: var(--nx-shadow);
}
.nx-ai-glow { position: absolute; width: 280px; height: 280px; right: -110px; top: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 160, 0, .55), transparent 65%); pointer-events: none; }
.nx-ai-icon { position: relative; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; font-size: 21px; color: var(--nx-ink); background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); box-shadow: 0 10px 26px rgba(245, 160, 0, .4); }
.nx-ai-card h2 { position: relative; margin: 14px 0 6px; font-size: 19px; font-weight: 800; color: #fff; }
.nx-ai-card p { position: relative; margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, .75); }
.nx-ai-prompts { position: relative; display: grid; gap: 7px; margin-bottom: 16px; }
.nx-ai-prompts button {
  text-align: left; padding: 9px 12px; font: 500 12.5px var(--nx-font); color: rgba(255, 255, 255, .9); cursor: pointer;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; transition: all .15s;
}
.nx-ai-prompts button:hover { background: rgba(245, 160, 0, .16); border-color: rgba(245, 160, 0, .45); color: #fff; }
.nx-ai-cta {
  position: relative; width: 100%; display: inline-flex; justify-content: center; align-items: center; gap: 8px; height: 46px;
  font: 800 14px var(--nx-font); color: var(--nx-ink); cursor: pointer; border: 0; border-radius: 13px;
  background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); transition: transform .15s, box-shadow .15s;
}
.nx-ai-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(245, 160, 0, .35); }

.nx-type-row {
  width: 100%; display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; padding: 8px 6px;
  font: 600 13px var(--nx-font); color: var(--nx-ink-3); background: transparent; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
}
.nx-type-row:hover { background: var(--nx-surface-2); }
.nx-type-label i { width: 18px; color: var(--nx-orange-600); }
.nx-type-bar { height: 8px; border-radius: 999px; background: var(--nx-surface-3); overflow: hidden; }
.nx-type-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--nx-orange), var(--nx-orange-2)); }
.nx-type-count { text-align: right; color: var(--nx-ink); font-weight: 800; }

/* ---------- Visor: tarjeta resaltada por enlace directo ---------- */
.file-card.is-highlighted {
  outline: 3px solid var(--nx-orange) !important; outline-offset: 3px;
  box-shadow: 0 0 0 8px rgba(245, 160, 0, .18), var(--nx-shadow) !important;
  animation: nx-glow 1.6s ease-in-out 3;
}

/* ---------- Visores de documentos ---------- */
.nx-viewer-ai { background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)) !important; color: var(--nx-ink) !important; border-color: transparent !important; font-weight: 700 !important; }
body.file-viewer-body .nx-assistant { bottom: 18px; right: 18px; }
body.file-viewer-body .nx-assistant-fab { height: 50px; padding-right: 18px; }
body.file-viewer-body .nx-fab-icon, body.file-viewer-body .nx-fab-pulse { width: 38px; height: 38px; }

/* ---------- Animaciones ---------- */
@keyframes nx-spin { to { transform: rotate(360deg); } }
@keyframes nx-pop { from { transform: scale(.4); } to { transform: scale(1); } }
@keyframes nx-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes nx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nx-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes nx-bounce { 0%, 80%, 100% { transform: scale(.55); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@keyframes nx-pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 160, 0, .5); } 70% { box-shadow: 0 0 0 16px rgba(245, 160, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 160, 0, 0); } }
@keyframes nx-glow { 50% { box-shadow: 0 0 0 14px rgba(245, 160, 0, .08), var(--nx-shadow); } }

/* ---------- Adaptación a pantallas ---------- */
@media (max-width: 1199px) {
  .nx-search-trigger { min-width: 0; }
  .nx-search-trigger span, .nx-search-trigger kbd { display: none; }
  .nx-search-trigger { width: 42px; padding: 0; justify-content: center; }
}
@media (max-width: 991px) {
  .nx-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .nx-assistant { right: 14px; bottom: 14px; }
  .nx-fab-label { display: none; }
  .nx-assistant-fab { padding: 0 7px; height: 56px; }
  .nx-assistant-panel, .nx-assistant.is-expanded .nx-assistant-panel {
    position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0;
  }
  .nx-hide-mobile { display: none; }
  .nx-bubble { max-width: 94%; }
  .nx-palette { padding: 0; }
  .nx-palette-dialog { max-height: 100vh; height: 100%; border-radius: 0; }
  .nx-palette-footer span { display: none; }
  .nx-hero-search button { padding: 0 14px; }
  .nx-type-row { grid-template-columns: 100px 1fr 36px; }
  .nx-bell-menu { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
  body.nx-assistant-open { overflow: hidden; }
}
@media print {
  .nx-assistant, .nx-palette, .nx-search-trigger, .nx-bell-wrap { display: none !important; }
}

/* =========================================================
   Newton · emblema, botón flotante y accesos
   ========================================================= */
.nx-newton-mark { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; overflow: visible; }
.nx-newton-mark .nx-mark-fill { opacity: .16; }
.nx-newton-mark .nx-mark-apple { fill: #e53935; }
.nx-newton-mark .nx-mark-leaf { fill: #43a047; }
.nx-fab-icon .nx-newton-mark { font-size: 27px; }
.nx-assistant-avatar .nx-newton-mark { font-size: 26px; }
.nx-welcome-badge .nx-newton-mark { font-size: 34px; color: var(--nx-ink); }
.nx-ai-icon .nx-newton-mark { font-size: 30px; }
.nx-palette-ask .nx-newton-mark { font-size: 16px; }
.nx-viewer-ai .nx-newton-mark { font-size: 18px; margin-right: 2px; }
.dashboard-secondary-action .action-icon .nx-newton-mark { font-size: 20px; }

.nx-fab-label { display: grid; line-height: 1.1; text-align: left; }
.nx-fab-label strong { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.nx-fab-label small { font-size: 10.5px; font-weight: 600; color: rgba(255, 255, 255, .62); letter-spacing: .04em; text-transform: uppercase; }
.nx-beta { margin-left: 6px; padding: 2px 7px; font-size: 10px; font-weight: 800; letter-spacing: .08em; vertical-align: middle; color: var(--nx-ink); background: var(--nx-orange); border-radius: 999px; }
.nx-ai-kicker { position: relative; margin: 14px 0 0 !important; font-size: 11px !important; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--nx-orange-2) !important; }
.nx-ai-kicker + h2 { margin-top: 2px !important; font-size: 24px !important; }

/* Menú lateral */
.nx-sidebar-tools { flex: 0 0 auto; display: grid; gap: 8px; padding: 10px 2px 4px; }
.nx-sidebar-newton {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px; text-align: left; cursor: pointer;
  color: #fff; font-family: var(--nx-font);
  background: linear-gradient(135deg, rgba(245, 160, 0, .22), rgba(245, 160, 0, .06));
  border: 1px solid rgba(245, 160, 0, .35); border-radius: 14px; transition: transform .2s var(--nx-ease), background .2s;
}
.nx-sidebar-newton:hover { transform: translateY(-2px); background: linear-gradient(135deg, rgba(245, 160, 0, .32), rgba(245, 160, 0, .1)); }
.nx-sidebar-newton-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--nx-ink); background: linear-gradient(135deg, var(--nx-orange-2), var(--nx-orange)); }
.nx-sidebar-newton-icon .nx-newton-mark { font-size: 23px; }
.nx-sidebar-newton-copy { display: grid; min-width: 0; line-height: 1.2; }
.nx-sidebar-newton-copy strong { font-size: 12.5px; font-weight: 800; }
.nx-sidebar-newton-copy small { font-size: 10.5px; color: rgba(255, 255, 255, .6); }
.nx-sidebar-search {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px; cursor: pointer;
  color: rgba(255, 255, 255, .72); font: 600 12px var(--nx-font);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px;
}
.nx-sidebar-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-sidebar-search kbd { color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); }
.nx-sidebar-search:hover { color: #fff; background: rgba(255, 255, 255, .09); }
body.newson-app .nx-sidebar-note { margin: 0 !important; }

/* Inicio de sesión */
body.newson-login-page h1, body.newson-login-page h2, body.newson-login-page .auth-input, body.newson-login-page button { font-family: var(--nx-font) !important; }
.nx-auth-newton { border-color: rgba(245, 160, 0, .45) !important; background: rgba(245, 160, 0, .14) !important; }
.nx-auth-newton .nx-newton-mark { font-size: 16px; color: var(--nx-orange-2); margin-right: 2px; }
@media (max-width: 767px) {
  .nx-fab-label { display: none; }
}
/* Logo en pantallas estrechas: el texto del logo es blanco, necesita fondo oscuro. */
@media (max-width: 860px) { body.newson-login-page .auth-mobile-logo { display: inline-flex !important; } }
body.newson-login-page .auth-mobile-logo {
  padding: 10px 16px; border-radius: 14px;
  background: linear-gradient(135deg, #3a424b, #20262d); box-shadow: 0 8px 20px rgba(20, 25, 31, .2);
}
