:root {
  --bg: #0f0f13;
  --panel: #17171c;
  --panel2: #1f1f27;
  --border: #2a2a33;
  --text: #e8e8ee;
  --muted: #9a9aa8;
  --accent: #8b5cf6;
  --accent2: #d946ef;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- Public Home Page & Auth ---------- */
#auth {
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: radial-gradient(1300px 700px at 50% -10%, #2a1b4e, var(--bg));
  scroll-behavior: smooth;
}

/* Navbar */
.public-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(23, 23, 28, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.public-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.public-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.public-brand .brand-icon {
  font-size: 26px;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 6px 10px;
  border-radius: 12px;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}
.brand-sub {
  color: var(--accent);
  font-size: 14px;
}
.brand-tag {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.public-nav-links {
  display: flex;
  gap: 24px;
}
.pnav-link {
  color: #c4c4d4;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.pnav-link:hover {
  color: #fff;
}
.public-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pnav-btn-login {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.pnav-btn-login:hover {
  background: rgba(255, 255, 255, 0.16);
}
.pnav-btn-wa {
  background: #25D366;
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s, background 0.2s;
}
.pnav-btn-wa:hover {
  background: #20ba59;
  transform: translateY(-1px);
}

/* Hero Section */
.public-hero-section {
  padding: 80px 24px 40px;
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}
.public-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 24px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
}
.public-hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 40%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.public-hero-subtitle {
  font-size: 17px;
  color: #9a9aa8;
  line-height: 1.6;
  max-width: 780px;
  margin: 0 auto 36px;
}
.public-hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.pbtn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}
.pbtn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5);
}
.pbtn-register-action {
  background: #25D366;
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.3);
}
.pbtn-register-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.45);
}

/* Auth Card Section */
.auth-section-wrapper {
  padding: 40px 24px 70px;
  display: flex;
  justify-content: center;
}
.auth-card {
  width: 440px;
  max-width: 100%;
  background: rgba(23, 23, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 40px rgba(139, 92, 246, 0.15);
}
.auth-card .logo {
  font-size: 38px;
  text-align: center;
  margin-bottom: 6px;
}
.auth-card h1 {
  text-align: center;
  font-size: 24px;
  letter-spacing: -0.5px;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 22px;
}
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#auth-form input {
  width: 100%;
  padding: 13px 15px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 14px;
}
#auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}
#auth-form button[type=submit] {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
  transition: transform 0.15s;
}
#auth-form button[type=submit]:hover {
  transform: translateY(-1px);
}
.error {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}

/* WhatsApp Register Panel */
.wa-register-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wa-box-header {
  text-align: center;
}
.wa-badge-icon {
  font-size: 34px;
  margin-bottom: 6px;
}
.wa-box-header h3 {
  font-size: 18px;
  color: #fff;
  margin-bottom: 8px;
}
.wa-box-desc {
  font-size: 13px;
  color: #9a9aa8;
  line-height: 1.5;
}
.wa-direct-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s, background 0.2s;
}
.wa-direct-btn:hover {
  background: #20ba59;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.5);
}
.wa-btn-icon {
  font-size: 24px;
}
.wa-btn-texts {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.wa-btn-title {
  font-size: 14px;
}
.wa-phone-number {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 500;
}
.wa-contact-details {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-detail-row {
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  gap: 8px;
}
.wa-detail-label {
  color: #8b8b98;
  font-weight: 600;
}
.wa-detail-val {
  color: #e2e2ec;
  font-weight: 500;
  text-align: right;
}

/* Sections on Public Landing Page */
.public-agents-section, .public-trust-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
}
.section-header-centered {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 44px;
}
.section-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}
.section-header-centered h2 {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.section-header-centered p {
  font-size: 15px;
  color: #9a9aa8;
}

/* Agents Grid */
.public-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.pagent-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pagent-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.pagent-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.pagent-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.pagent-role {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pagent-info p {
  font-size: 13px;
  color: #9a9aa8;
  line-height: 1.5;
}

/* Trust Grid */
.public-trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.ptrust-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 30px 24px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}
.ptrust-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.35);
}
.ptrust-icon {
  font-size: 34px;
  margin-bottom: 14px;
}
.ptrust-card h4 {
  font-size: 18px;
  color: #fff;
  margin-bottom: 10px;
}
.ptrust-card p {
  font-size: 14px;
  color: #9a9aa8;
  line-height: 1.55;
}

/* Public Footer */
.public-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d0d11;
  padding: 50px 24px 30px;
}
.public-footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.public-footer-brand {
  max-width: 480px;
}
.footer-logo {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  display: block;
  margin-bottom: 10px;
}
.public-footer-brand p {
  font-size: 13px;
  color: #8b8b98;
  line-height: 1.6;
}
.public-footer-contact h4 {
  font-size: 14px;
  color: #fff;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.public-footer-contact p {
  font-size: 13px;
  color: #8b8b98;
  margin-bottom: 6px;
}
.public-footer-contact a {
  color: #25D366;
  text-decoration: none;
  font-weight: 600;
}
.public-footer-contact a:hover {
  text-decoration: underline;
}
.public-footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 12px;
  color: #6b6b78;
}

/* Responsiveness */
@media (max-width: 768px) {
  .public-nav-links { display: none; }
  .public-hero-title { font-size: 30px; }
  .public-hero-subtitle { font-size: 15px; }
  .auth-card { width: 100%; padding: 24px 20px; }
}

/* ---------- Layout ---------- */
#app { display: flex; height: 100vh; }
.sidebar {
  width: 270px; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-head { display: flex; align-items: center; justify-content: center; padding: 16px; }
.brand { font-weight: 700; font-size: 17px; }
.nav-links { display: flex; flex-direction: column; gap: 2px; padding: 0 10px 10px; }
.nav-link {
  text-align: left; padding: 10px 12px; border: none; background: transparent; color: var(--muted);
  border-radius: 10px; cursor: pointer; font-size: 14px;
}
.nav-link.active { background: var(--panel2); color: var(--text); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--border); }
#user-chip { font-size: 13px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
#logout { border: none; background: var(--panel2); color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }

/* ---------- Chat ---------- */
#view-chat { justify-content: space-between; }
.chat-top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: rgba(23, 23, 28, 0.7);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.jarvis-badge, .laura-badge {
  font-size: 12px; font-weight: 700; color: #a855f7; background: rgba(168, 85, 247, 0.12);
  padding: 5px 12px; border-radius: 20px; border: 1px solid rgba(168, 85, 247, 0.3);
  letter-spacing: 0.4px;
}
.voice-mode-controls { display: flex; align-items: center; gap: 12px; }
.voice-toggle-label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.voice-toggle-label input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.stop-audio-btn {
  background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171; border-radius: 8px; padding: 4px 10px; font-size: 12px;
  cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.stop-audio-btn:hover { background: rgba(239, 68, 68, 0.25); }
.messages { flex: 1; overflow-y: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; }
.welcome { text-align: center; color: var(--muted); margin: 40px 0; }
.welcome h2 { color: var(--text); font-size: 26px; margin-bottom: 8px; font-weight: 700; }
.jarvis-avatar-badge, .laura-avatar-badge {
  font-size: 38px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, rgba(23, 23, 28, 0.9) 70%);
  border: 1px solid rgba(168, 85, 247, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.3);
}
.welcome-subtitle {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 560px;
  margin: 6px auto 20px;
}
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}
.quick-prompt-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.quick-prompt-btn:hover {
  border-color: var(--accent);
  background: var(--panel2);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}
.msg { max-width: 780px; width: fit-content; padding: 14px 18px; border-radius: var(--radius); line-height: 1.55; font-size: 15px; white-space: pre-wrap; position: relative; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-voice-btn {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; margin-right: 8px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 4px 9px; font-size: 11px; cursor: pointer; transition: all 0.2s;
}
.msg-voice-btn:hover { color: var(--text); border-color: var(--accent); }
.msg-voice-btn.playing { background: rgba(139, 92, 246, 0.2); color: #c084fc; border-color: var(--accent); }
.msg .src { display: block; margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.sources { max-width: 780px; margin: 0 auto 12px; width: 100%; display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px; }
.src-chip { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 5px 10px; }
.chat-form {
  display: flex; gap: 10px; align-items: flex-end; max-width: 820px; margin: 0 auto;
  padding: 12px 16px 8px; width: 100%;
}
.chat-action-btn,
.mic-btn {
  width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--panel); color: var(--text); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
  flex-shrink: 0;
}
.chat-action-btn:hover,
.mic-btn:hover { background: var(--panel2); border-color: var(--accent); }
.chat-action-btn.uploading {
  opacity: 0.6; pointer-events: none; animation: pulse-mic 1.2s infinite;
}
.mic-btn.listening {
  background: #ef4444; color: #fff; border-color: #ef4444;
  animation: pulse-mic 1.2s infinite;
}
@keyframes pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
#chat-input {
  flex: 1; resize: none; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 15px; max-height: 160px; font-family: inherit;
}
#chat-input:focus { outline: none; border-color: var(--accent); }
#send-btn {
  width: 44px; height: 44px; border: none; border-radius: 14px; font-size: 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  flex-shrink: 0;
}
#send-btn:disabled { opacity: .4; cursor: not-allowed; }
.hint { text-align: center; color: var(--muted); font-size: 12px; padding: 6px 0 14px; }
.cursor { display: inline-block; width: 8px; height: 16px; background: var(--accent); animation: blink 1s infinite; vertical-align: -2px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Docs ---------- */
.docs-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 8px; }
.upload-btn {
  padding: 10px 18px; border-radius: 12px; cursor: pointer; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600;
}
.docs-list { padding: 12px 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.doc-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.doc-card h4 { font-size: 14px; margin-bottom: 6px; word-break: break-word; }
.doc-card p { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.doc-card .meta { font-size: 11px; color: var(--muted); }
.doc-card .badge { display: inline-block; padding: 3px 8px; border-radius: 8px; font-size: 11px; margin-right: 6px; }
.badge.processed { background: rgba(34,197,94,.15); color: var(--green); }
.badge.error { background: rgba(239,68,68,.15); color: var(--red); }
.doc-card .del { margin-top: 10px; background: var(--panel2); border: 1px solid var(--border); color: var(--red); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; }

/* ---------- Status / Motores Dashboard ---------- */
.status-card-wrapper { margin: 20px 28px; }
.status-dashboard { display: flex; flex-direction: column; gap: 20px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.status-card-item { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.status-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.status-item-title { font-size: 15px; font-weight: 600; color: var(--text); }
.status-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13.5px; }
.status-row:last-child { border-bottom: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* Modelos en Disco */
.status-section-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.status-section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.models-disk-list { display: flex; flex-direction: column; gap: 10px; }
.model-disk-item { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; transition: border-color 0.2s; }
.model-disk-item.model-disk-active { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.04); }
.model-disk-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.model-disk-name { font-weight: 600; font-size: 14px; color: var(--text); font-family: monospace; }
.model-disk-size { margin-left: auto; font-size: 12px; color: var(--text-muted); font-family: monospace; }
.model-disk-desc { font-size: 12.5px; color: var(--text-muted); }

.btn-activate-model {
  background: #2563eb; color: #ffffff; border: none; border-radius: 8px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-activate-model:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn-activate-model:disabled { opacity: 0.5; cursor: not-allowed; }

.engine-settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px; margin-top: 14px;
}
.setting-item { display: flex; flex-direction: column; gap: 6px; }
.setting-label { font-size: 13px; color: var(--text); font-weight: 500; display: flex; justify-content: space-between; }
.setting-val-badge { color: #38bdf8; font-family: monospace; font-weight: 600; }
.setting-desc { font-size: 11.5px; color: var(--text-muted); }
.setting-input-range { width: 100%; accent-color: #38bdf8; cursor: pointer; }
.setting-select {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px;
}
.btn-save-settings {
  margin-top: 16px; background: #2563eb; color: #fff; border: none;
  padding: 8px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.btn-save-settings:hover { background: #1d4ed8; }

.status-actions { margin: 18px 28px; }
.restart-btn {
  padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 14px;
}
.restart-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Clúster & Balanceo de Carga ---------- */
.cluster-nodes-list { display: flex; flex-direction: column; gap: 14px; }
.node-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); transition: border-color 0.2s;
}
.node-card.node-master { border-color: rgba(56,189,248,0.4); background: rgba(56,189,248,0.03); }
.node-card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.node-card-title { display: flex; align-items: center; gap: 10px; }
.node-name { font-size: 15px; font-weight: 600; color: var(--text); }
.node-host { font-family: monospace; font-size: 12.5px; color: var(--text-muted); background: var(--panel2); padding: 3px 8px; border-radius: 6px; }
.node-badges { display: flex; align-items: center; gap: 8px; }
.node-details-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px;
}
.node-detail-item { display: flex; flex-direction: column; gap: 3px; }
.node-detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.node-detail-val { font-weight: 600; color: var(--text); font-family: monospace; }
.node-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.btn-node-ping {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: 0.2s;
}
.btn-node-ping:hover { border-color: var(--accent); color: var(--accent); }
.btn-node-del {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red);
  padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; transition: 0.2s;
}
.btn-node-del:hover { background: rgba(239,68,68,0.2); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* Toasts */
#toast { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--border); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.35); font-size: 13px; animation: slideIn .2s ease; }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); color: var(--green); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Historial de Chats en Sidebar ---------- */
.convs-sidebar-section {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  border-top: 1px solid var(--border); padding: 12px 10px; overflow: hidden;
}
.convs-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.new-chat-btn {
  background: var(--panel2); border: 1px solid var(--border); color: var(--accent);
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 12px;
}
.new-chat-btn:hover { background: var(--accent); color: #fff; }
.convs-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.conv-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--muted);
  cursor: pointer; transition: background 0.15s;
}
.conv-item:hover, .conv-item.active { background: var(--panel2); color: var(--text); }
.conv-item.active { border-left: 2px solid var(--accent); }
.conv-title {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px;
}
.conv-del {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 2px 4px; border-radius: 4px; opacity: 0.5;
}
.conv-del:hover { color: var(--red); opacity: 1; }
.conv-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 14px 0; }

/* ---------- API Keys & Super Admin ---------- */
.section-desc { padding: 0 28px 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.keys-list { padding: 12px 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.key-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.key-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.key-card-head h4 { font-size: 14px; color: var(--text); }
.key-box {
  display: flex; align-items: center; justify-content: space-between; background: var(--panel2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0;
}
.key-box code { font-size: 12px; color: var(--accent); font-family: monospace; overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  background: var(--accent); border: none; color: #fff; border-radius: 6px;
  padding: 4px 8px; font-size: 11px; cursor: pointer; font-weight: 600;
}
.copy-btn:hover { opacity: 0.9; }
.key-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--muted); }
.del-key-btn {
  background: transparent; border: 1px solid var(--border); color: var(--red);
  padding: 4px 10px; border-radius: 6px; font-size: 11px; cursor: pointer;
}
.del-key-btn:hover { background: rgba(239,68,68,0.1); }

/* Badges de Sistemas */
.badge.mikroabi { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge.sosfter { background: rgba(234,179,8,0.15); color: #facc15; }
.badge.finanzas { background: rgba(34,197,94,0.15); color: var(--green); }
.badge.general { background: rgba(168,85,247,0.15); color: var(--accent2); }
.badge.admin { background: rgba(217,70,239,0.15); color: var(--accent2); }
.badge.tenant { background: var(--panel2); color: var(--text); }

/* Modales */
.modal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 500;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-card h3 { font-size: 18px; margin-bottom: 6px; }
.modal-card select, .modal-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.cancel-btn {
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer;
}

/* Super Admin Grid & Tables */
.admin-grid { padding: 12px 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; align-items: center;
}
.stat-val { font-size: 32px; font-weight: 700; color: var(--accent); }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.admin-table-container { margin: 0 28px 24px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--panel2); color: var(--muted); font-size: 12px; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: none; }

/* API Playground & Docs */
.api-playground-card, .api-docs-card {
  margin: 16px 28px 20px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.playground-head h3, .api-docs-card h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.playground-head .subtitle, .api-docs-card .subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.playground-body { margin-top: 14px; }
.playground-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.field-col label, .field-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field-col select, .prompt-input-group input {
  width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 13px; outline: none;
}
.field-col select:focus, .prompt-input-group input:focus { border-color: var(--accent); }
.prompt-input-group { display: flex; gap: 10px; }
.prompt-input-group input { flex: 1; }
.playground-result {
  margin-top: 16px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
}
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.playground-result pre {
  font-family: monospace; font-size: 12px; color: #a5b4fc; white-space: pre-wrap;
  word-break: break-word; max-height: 200px; overflow-y: auto; line-height: 1.45;
}

/* Code box */
.code-box {
  margin-top: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.code-box-head {
  display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.25);
  padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--muted);
}
.code-box pre {
  padding: 14px; font-family: monospace; font-size: 12px; color: #34d399; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all;
}
.key-actions { display: flex; gap: 6px; }
.reveal-btn {
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer;
}
.reveal-btn:hover { color: var(--text); }

/* ---------- Módulo de Agentes Especialistas ---------- */
.agent-chat-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 14px;
}
.agent-picker-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.agent-picker-select {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.agent-picker-select:focus {
  border-color: var(--accent);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.agent-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.agent-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12);
  transform: translateY(-2px);
}
.agent-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}
.agent-avatar {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel2);
  border-radius: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.agent-info {
  flex: 1;
  min-width: 0;
}
.agent-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-role {
  font-size: 12px;
  color: #a855f7;
  font-weight: 600;
  margin-top: 3px;
}
.agent-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 14px;
  flex: 1;
}
.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.agent-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.agent-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-agent-chat {
  flex: 1;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s;
}
.btn-agent-chat:hover {
  opacity: 0.9;
}
.btn-agent-edit {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-agent-edit:hover {
  border-color: var(--accent);
}
.btn-agent-del {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-agent-del:hover {
  background: rgba(239, 68, 68, 0.25);
}
.msg-agent-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 6px;
}

/* ---------------- Home Page (Página de Inicio) ---------------- */
.home-hero {
  padding: 32px 36px;
  margin-bottom: 24px;
  background: radial-gradient(ellipse at top left, rgba(168, 85, 247, 0.15) 0%, rgba(23, 23, 28, 0.8) 70%);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.home-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.home-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
}
.status-dot-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.home-hero h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}
.home-subtitle {
  font-size: 15px;
  color: var(--muted);
  max-width: 680px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}
.home-cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.home-primary-btn {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
  transition: all 0.2s;
}
.home-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
}
.home-secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.home-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--muted);
}
.home-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 36px 28px;
}
.home-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s, border-color 0.2s;
}
.home-kpi-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
  transform: translateY(-2px);
}
.home-kpi-icon {
  font-size: 26px;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-kpi-info {
  display: flex;
  flex-direction: column;
}
.home-kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.home-kpi-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 2px 0;
}
.home-kpi-sub {
  font-size: 11px;
  color: var(--muted);
}
.home-section-title {
  padding: 0 36px 14px;
}
.home-section-title h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 0;
}
.home-section-title p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  padding: 0 36px 28px;
}
.home-module-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.home-module-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.module-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.module-card-icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.module-card-head h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.home-module-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex: 1;
}
.module-card-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.home-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  padding: 0 36px 28px;
}
.home-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.home-action-btn:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.4);
  transform: translateY(-2px);
}
.action-btn-icon {
  font-size: 22px;
}
.action-btn-text strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}
.action-btn-text small {
  font-size: 11px;
  color: var(--muted);
}
.home-recent-convs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 36px 40px;
}
.home-conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.home-conv-item:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.02);
}
.home-conv-open-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Modo Cariñosa Toggle Controls */
.romantic-mode-controls {
  display: flex;
  align-items: center;
}
.romantic-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}
.romantic-toggle-btn:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}
.romantic-toggle-btn.active {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(236, 72, 153, 0.25));
  border-color: #f43f5e;
  color: #fda4af;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
  font-weight: 600;
}
.romantic-toggle-btn .romantic-icon {
  font-size: 13px;
  transition: transform 0.2s;
}
.romantic-toggle-btn.active .romantic-icon {
  transform: scale(1.2);
  animation: heartPulse 1.8s infinite ease-in-out;
}
@keyframes heartPulse {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.35); }
}

/* Media Card Styling for Qwen-Image & Wan 2.1 in Chat */
.chat-media-card {
  margin: 12px 0 6px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 16px rgba(236, 72, 153, 0.15);
  max-width: 520px;
  transition: all 0.25s ease;
}
.chat-media-card:hover {
  border-color: rgba(236, 72, 153, 0.65);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 22px rgba(236, 72, 153, 0.25);
}
.chat-media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(236, 72, 153, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.media-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #f472b6;
  letter-spacing: 0.5px;
}
.media-title {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.chat-media-preview {
  position: relative;
  background: #020617;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
}
.chat-media-img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.chat-media-img:hover {
  transform: scale(1.02);
}
.chat-media-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.9);
}
.chat-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s;
}
.chat-media-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.chat-media-btn.primary {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fff;
  border: none;
}
.chat-media-btn.primary:hover {
  filter: brightness(1.15);
}

/* ---------- Previsualización de Archivos Adjuntos ---------- */
.chat-attachments-bar {
  max-width: 820px;
  margin: 0 auto;
  padding: 6px 16px 2px;
  width: 100%;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
  max-width: 260px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.2s ease-in-out;
}

.attachment-chip .attachment-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.attachment-chip .attachment-doc-icon {
  font-size: 18px;
  line-height: 1;
}

.attachment-chip .attachment-doc-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.attachment-chip .attachment-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  font-weight: 500;
}

.attachment-chip .attachment-size {
  font-size: 10px;
  color: var(--muted);
}

.attachment-chip .attachment-remove-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-left: 2px;
  transition: all 0.15s;
}

.attachment-chip .attachment-remove-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* ---------- Adjuntos dentro de los Mensajes de Chat ---------- */
.msg-attachments-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.msg-attached-img-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 260px;
}

.msg-attached-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.msg-attached-img:hover {
  transform: scale(1.02);
}

.msg-attached-img-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg.assistant .msg-attached-img-name {
  color: var(--muted);
}

.msg-attached-doc-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  max-width: 300px;
}

.msg.assistant .msg-attached-doc-card {
  background: var(--panel2);
  border-color: var(--border);
}

.msg-attached-doc-card:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent);
}

.msg-attached-doc-card .doc-icon {
  font-size: 22px;
  line-height: 1;
}

.msg-attached-doc-card .doc-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msg-attached-doc-card .doc-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-attached-doc-card .doc-meta {
  font-size: 10.5px;
  opacity: 0.8;
}

/* Estado Drag-Over en la vista de chat */
#view-chat.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
  background: rgba(99, 102, 241, 0.03);
}




