/* NCT Hub · Chat Avanzado · v2.0 */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #171717;
  --bg-tertiary: #1f1f1f;
  --bg-hover: #2a2a2a;
  --border: #2a2a2a;
  --border-light: #3a3a3a;
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8e8e8e;
  --accent: #10a37f;
  --accent-hover: #0d8a6a;
  --user-bubble: #2a2b32;
  --ai-bubble: transparent;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 24px;
}
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-tertiary: #ececec;
  --bg-hover: #e0e0e0;
  --border: #e5e5e5;
  --text-primary: #0d0d0d;
  --text-secondary: #4a4a4a;
  --text-tertiary: #8e8e8e;
  --user-bubble: #ececec;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; outline: none; border: none; background: none; color: inherit; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar {
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 10;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #2a8af0);
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 18px;
}
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--text-tertiary); }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.model-selector { margin: 8px 12px; position: relative; }
.model-current {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.model-current:hover { background: var(--bg-tertiary); }
.model-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px; color: white;
  flex-shrink: 0;
}
.model-avatar.small { width: 28px; height: 28px; font-size: 11px; }
.model-avatar.l70 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.model-avatar.ml { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.model-avatar.nm { background: linear-gradient(135deg, #10b981, #06b6d4); }
.model-avatar.ad { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.model-avatar.ag { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.model-avatar.mx { background: linear-gradient(135deg, #ff6b6b, #ee0979); }
.model-avatar.g4 { background: linear-gradient(135deg, #4285f4, #34a853); }
.model-name { font-weight: 600; font-size: 13px; }
.model-desc { font-size: 11px; color: var(--text-tertiary); }
.chevron { transition: transform 0.2s; }
.model-current.open .chevron { transform: rotate(180deg); }
.model-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
}
.model-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.model-option:hover { background: var(--bg-hover); }
.model-option-name { font-size: 13px; font-weight: 500; }
.model-option-desc { font-size: 11px; color: var(--text-tertiary); }
.sidebar-section { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: 8px 12px 4px;
}
.conv-list { display: flex; flex-direction: column; gap: 2px; }
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.conv-item.active { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: background 0.15s;
}
.user-pill:hover { background: var(--bg-hover); }
.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-plan { font-size: 11px; color: var(--text-tertiary); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  z-index: 5;
}
.topbar-title { flex: 1; font-weight: 600; font-size: 14px; }
.topbar-actions { display: flex; gap: 4px; }
.agent-active { background: var(--accent) !important; color: white !important; }
#menuBtn { display: none; }
.dropzone {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.95);
  z-index: 50;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
}
.dropzone-inner { text-align: center; }
.dropzone-inner h2 { margin: 16px 0 8px; }
.dropzone-inner p { color: var(--text-secondary); margin-bottom: 20px; }
.primary-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background 0.15s;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { background: var(--bg-tertiary); cursor: not-allowed; }
.files-bar {
  display: flex;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: var(--bg-secondary);
}
.file-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.file-chip:hover { background: var(--bg-hover); }
.file-chip .x { color: var(--text-tertiary); font-size: 14px; }
.messages { flex: 1; overflow-y: auto; scroll-behavior: smooth; padding: 24px 0; }
.welcome { max-width: 720px; margin: 60px auto 0; padding: 0 24px; text-align: center; }
.welcome-logo { font-size: 48px; margin-bottom: 16px; }
.welcome-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; background: linear-gradient(135deg, var(--accent), #2a8af0); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.welcome-sub { color: var(--text-secondary); margin-bottom: 32px; }
.suggestions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-width: 600px; margin: 0 auto; }
.suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  transition: all 0.15s;
}
.suggestion:hover { background: var(--bg-tertiary); border-color: var(--border-light); }
.sug-icon { font-size: 18px; }
.sug-text { flex: 1; }
.message { display: flex; gap: 16px; padding: 16px 24px; max-width: 800px; margin: 0 auto; }
.message.assistant { background: var(--bg-secondary); }
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px; color: white;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #2a8af0);
}
.msg-avatar.user { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.msg-avatar.l70 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.msg-avatar.ml { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.msg-avatar.nm { background: linear-gradient(135deg, #10b981, #06b6d4); }
.msg-avatar.ad { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.msg-avatar.ag { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.msg-avatar.mx { background: linear-gradient(135deg, #ff6b6b, #ee0979); }
.msg-avatar.g4 { background: linear-gradient(135deg, #4285f4, #34a853); }
.msg-body { flex: 1; min-width: 0; }
.msg-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.msg-name .ts { font-weight: 400; color: var(--text-tertiary); margin-left: 6px; font-size: 11px; }
.msg-content { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.msg-content code { background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 13px; }
.msg-content pre { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin: 8px 0; overflow-x: auto; }
.msg-content pre code { background: none; padding: 0; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing span { width: 6px; height: 6px; background: var(--text-tertiary); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.input-area { padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--bg-primary); }
.input-box {
  max-width: 800px;
  margin: 0 auto;
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 12px;
  transition: border-color 0.15s;
}
.input-box:focus-within { border-color: var(--text-tertiary); }
#input { flex: 1; resize: none; font-size: 15px; line-height: 1.5; max-height: 200px; padding: 8px 4px; }
.attach-btn, .ai-detect-btn { color: var(--text-tertiary); }
.send-btn {
  width: 36px; height: 36px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: grid; place-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.send-btn:disabled { background: var(--bg-tertiary); color: var(--text-tertiary); cursor: not-allowed; }
.send-btn:not(:disabled):hover { background: var(--accent-hover); transform: scale(1.05); }
.send-btn svg { width: 18px; height: 18px; }
.input-hint { text-align: center; font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9; display: none; }
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.modal[hidden] { display: none !important; }
[hidden] { display: none !important; }
.modal-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: grid;
  place-items: center;
}
.modal-inner h2 { margin-bottom: 16px; }
.modal-inner textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  resize: vertical;
  margin-bottom: 12px;
}
#aiResult, #fileContent {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
}
#fileContent { max-height: 60vh; overflow: auto; }
#integResult { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-top: 16px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; max-height: 40vh; overflow: auto; }
#integResult a { color: var(--accent); }
.softwares-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px; }
.sw-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: all 0.15s; }
.sw-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.sw-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sw-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.sw-name { font-weight: 600; font-size: 13px; }
.sw-desc { font-size: 11px; color: var(--text-tertiary); }
.sw-status { font-size: 12px; color: var(--success); }
.sw-status:not(.ok) { color: var(--text-tertiary); }
.sw-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.sw-act { padding: 4px 8px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
.sw-act:hover { background: var(--accent); color: white; border-color: var(--accent); }
.graph-container { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; width: 100%; min-height: 400px; }
.graph-container svg { display: block; width: 100%; height: 380px; }
.graph-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 11px; color: var(--text-tertiary); }
.graph-legend span { display: flex; align-items: center; gap: 6px; }
.graph-legend span span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kanboard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kb-col { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; min-height: 80px; }
.kb-col-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; display: flex; justify-content: space-between; }
.kb-col-title span { background: var(--bg-primary); padding: 1px 6px; border-radius: 8px; font-size: 10px; }
.kb-task { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 4px; padding: 6px; margin-bottom: 4px; font-size: 11px; }
.kb-task-title { font-weight: 500; margin-bottom: 2px; }
.kb-task-meta { display: flex; justify-content: space-between; color: var(--text-tertiary); font-size: 10px; }
.kb-prio { padding: 1px 4px; border-radius: 3px; background: var(--bg-tertiary); }
.kb-task[data-priority="high"] .kb-prio { background: var(--danger); color: white; }
.kb-task[data-priority="medium"] .kb-prio { background: var(--warning); color: black; }
.kb-task[data-priority="low"] .kb-prio { background: var(--success); color: white; }
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); z-index: 10; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  #menuBtn { display: grid; }
  .suggestions { grid-template-columns: 1fr; }
  .message { padding: 12px 16px; }
  .welcome { margin-top: 30px; }
  .welcome-title { font-size: 22px; }
}
.messages::-webkit-scrollbar, .sidebar-section::-webkit-scrollbar, .model-dropdown::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb, .sidebar-section::-webkit-scrollbar-thumb, .model-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
