@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

/* ==========================================================================
   UGO AI — HUMAN-CRAFTED ENTERPRISE WEB STYLES (ugos.ai)
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'Fira Code', monospace;

  /* Color Palette - Deep Charcoal & Elegant Amber */
  --bg-dark-base: #0E1117;
  --bg-dark-sidebar: #131720;
  --bg-dark-card: #191E28;
  --bg-dark-input: #202634;
  --bg-dark-hover: #272E3F;

  --accent-orange: #F06522;
  --accent-orange-glow: rgba(240, 101, 34, 0.15);
  --accent-cyan: #38BDF8;
  --accent-purple: #C084FC;
  --accent-green: #34D399;
  --accent-gold: #FBBF24;

  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-tertiary: #6B7280;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(240, 101, 34, 0.4);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-orange: 0 4px 14px rgba(240, 101, 34, 0.2);
}

/* Light Theme Variables */
body.theme-light {
  --bg-dark-base: #F8FAFC;
  --bg-dark-sidebar: #F1F5F9;
  --bg-dark-card: #FFFFFF;
  --bg-dark-input: #E2E8F0;
  --bg-dark-hover: #EDF2F7;

  --accent-orange: #EA580C;
  --accent-orange-glow: rgba(234, 88, 12, 0.12);
  --accent-cyan: #0284C7;
  --accent-purple: #9333EA;
  --accent-green: #059669;
  --accent-gold: #D97706;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #64748B;

  --border-light: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(234, 88, 12, 0.4);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-dark-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* APP FULLSCREEN CONTAINER */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR STYLES */
.sidebar {
  width: 280px;
  height: 100%;
  background-color: var(--bg-dark-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease, margin-left 0.3s ease;
  z-index: 100;
}

.sidebar.collapsed {
  margin-left: -280px;
}

.sidebar-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-logo {
  height: 32px;
  width: auto;
  color: var(--text-primary);
  display: block;
}

.brand-main {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: block;
}

.brand-ai {
  color: var(--accent-orange);
}

.brand-by {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  display: block;
}

/* New Chat Button */
.sidebar-action {
  padding: 14px 16px 10px;
}

.btn-new-chat {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  transition: all 0.2s ease;
}

.btn-new-chat:hover {
  background: var(--bg-dark-hover);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--accent-orange);
}

/* Search Input */
.sidebar-search {
  padding: 0 20px 12px;
  position: relative;
}

.sidebar-search input {
  width: 100%;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 36px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search input:focus {
  border-color: var(--border-focus);
}

.search-icon {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* Chat History Stream */
.sidebar-chats-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.chat-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 8px 8px 4px;
  letter-spacing: 0.5px;
}

.chats-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item-btn {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.chat-item-btn:hover {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
}

.chat-item-btn.active {
  background: rgba(255, 107, 0, 0.12);
  color: var(--accent-orange);
  font-weight: 600;
}

.chat-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.chat-item-actions {
  display: opacity;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-item-btn:hover .chat-item-actions {
  opacity: 1;
}

.chat-action-icon {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  padding: 4px;
}

.chat-action-icon:hover {
  color: var(--accent-orange);
}

/* Nav Modules */
.sidebar-nav-modules {
  padding: 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-module-btn {
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-module-btn:hover {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
}

.nav-module-btn.active {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
  border-left-color: var(--accent-orange);
  font-weight: 600;
}

/* Sidebar PWA / App Download Banner */
.sidebar-pwa-banner {
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
}

.sidebar-pwa-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(240, 101, 34, 0.08);
  border: 1px solid rgba(240, 101, 34, 0.2);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.sidebar-pwa-btn:hover {
  background: rgba(240, 101, 34, 0.15);
  border-color: rgba(240, 101, 34, 0.4);
}

.pwa-btn-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.pwa-btn-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-orange);
  line-height: 1.2;
}

.pwa-btn-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.2;
  margin-top: 1px;
}

.pwa-btn-arrow {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* User Profile Footer */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Sidebar Language Dropdown (opens upwards) */
#sidebar-lang-wrapper .lang-dropdown-menu {
  top: auto;
  bottom: calc(100% + 8px);
  right: 0;
  transform: translateY(8px);
}

#sidebar-lang-wrapper.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-orange);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN WORKSPACE */
.main-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-dark-base);
}

/* WORKSPACE HEADER */
.workspace-header {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn-ghost {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.icon-btn-ghost:hover {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
}

/* Workspace Brand Title */
.workspace-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-brand .brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Model Selector Dropdown */
.model-selector-wrapper {
  position: relative;
}

.model-select-btn {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.model-select-btn:hover {
  border-color: var(--border-focus);
}

.model-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 200;
}

.model-selector-wrapper.open .model-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.model-option {
  width: 100%;
  background: none;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.model-option:hover, .model-option.active {
  background: var(--bg-dark-hover);
}

.model-opt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.model-opt-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.model-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 107, 0, 0.15);
  color: var(--accent-orange);
  font-weight: 600;
}

.model-badge.pro {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

.model-opt-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: block;
}

/* Language Selector */
.lang-selector-wrapper {
  position: relative;
}

.icon-btn-text, .btn-app-cta {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-app-cta:hover {
  background: var(--bg-dark-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 150px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 200;
}

.lang-selector-wrapper.open .lang-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-opt {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
}

.lang-opt:hover, .lang-opt.active {
  background: var(--bg-dark-hover);
  color: var(--accent-orange);
}

.btn-usso {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-usso:hover {
  background: #1e293b;
  border-color: #36a9e1;
  box-shadow: 0 0 14px rgba(54, 169, 225, 0.3);
  transform: translateY(-1px);
}

.btn-usso.logged-in {
  background: #0f172a;
  border-color: rgba(54, 169, 225, 0.5);
}

.btn-usso.logged-in:hover {
  border-color: #36a9e1;
  background: #1e293b;
}

.usso-dropdown-menu.hidden {
  display: none !important;
}

/* WORKSPACE VIEWS */
.workspace-view {
  display: none;
  flex: 1;
  height: calc(100% - 60px);
  overflow: hidden;
  position: relative;
}

.workspace-view.active {
  display: flex;
  flex-direction: column;
}

/* VIEW 1: CHAT CANVAS & WELCOME CARDS */
.chat-welcome-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

.chat-welcome-container.hidden {
  display: none;
}

.welcome-hero {
  text-align: center;
  margin-bottom: 36px;
}

.welcome-logo-badge {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.welcome-logo-badge img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.welcome-logo-badge ugo-mascot {
  width: 44px;
  height: auto;
  color: var(--accent-orange, #f97316);
  pointer-events: none;
  display: block;
}

.welcome-title {
  font-family: var(--font-title);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 520px;
  margin: 0 auto;
}

.prompt-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.prompt-card {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: var(--bg-dark-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 12px;
}

.icon-orange { background: rgba(240, 101, 34, 0.12); color: var(--accent-orange); }
.icon-purple { background: rgba(192, 132, 252, 0.12); color: var(--accent-purple); }
.icon-cyan { background: rgba(56, 189, 248, 0.12); color: var(--accent-cyan); }
.icon-green { background: rgba(52, 211, 153, 0.12); color: var(--accent-green); }

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* CHAT THREAD MESSAGES AREA */
.chat-thread-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.chat-thread-container.hidden {
  display: none;
}

/* Chat Thread Sticky Sub-Header */
.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  margin-bottom: 20px;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-thread-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-thread-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

@media (min-width: 640px) {
  .chat-thread-title {
    max-width: 480px;
  }
}

.chat-thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ghost-sm {
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-ghost-sm:hover {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.messages-stream {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 20px;
}

.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.msg-user-row {
  justify-content: flex-end;
}

.msg-avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.msg-ugo-row .msg-avatar-badge {
  background: var(--accent-orange);
}

.msg-user-row .msg-avatar-badge {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  order: 2;
}

.msg-user-row .msg-body {
  align-items: flex-end;
}

.msg-user-row .msg-footer-bar {
  justify-content: flex-end;
}

.msg-body {
  max-width: 82%;
  display: flex;
  flex-direction: column;
}

.msg-bubble {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.msg-user-row .msg-bubble {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.18);
  border-top-right-radius: 4px;
}

.msg-ugo-row .msg-bubble {
  border-top-left-radius: 4px;
}

/* Rich Markdown Code Blocks */
.msg-bubble pre {
  background: #080A0E;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 12px 0;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 0.88rem;
  position: relative;
}

.msg-bubble code {
  font-family: var(--font-code);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88rem;
}

.msg-bubble pre code {
  background: none;
  padding: 0;
}

/* --- AFFINI CONTEXTUAL & COOKIELESS PARTNER CARDS (affini.ch) --- */
.affini-card-wrapper {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: affiniFadeIn 0.35s ease forwards;
}

.affini-card-wrapper:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: 0 6px 22px rgba(249, 115, 22, 0.12);
  transform: translateY(-1px);
}

@keyframes affiniFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.affini-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.72rem;
}

.affini-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-orange, #f97316);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(249, 115, 22, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.affini-category {
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
}

.affini-card-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.affini-icon-box {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.affini-text-content {
  flex: 1;
}

.affini-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.35;
}

.affini-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.affini-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.affini-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(249, 115, 22, 0.25));
  border: 1px solid var(--btn-accent, rgba(249, 115, 22, 0.4));
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.affini-cta-btn:hover {
  background: var(--btn-accent, #f97316);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

.affini-privacy-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #71717a);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Custom Web Components & Inline Pills for Affini */
affini-card {
  display: block;
  margin-top: 10px;
}

.affini-pill, affini-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.76rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  margin: 4px 2px;
}

.affini-pill:hover, affini-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--pill-color, #38bdf8);
  transform: translateY(-1px);
}

.affini-pill-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-orange, #f97316);
  background: rgba(249, 115, 22, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.affini-autotag-mount {
  margin: 12px 0;
}

.code-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  margin: -14px -14px 10px -14px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.copy-code-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-code-btn:hover {
  color: var(--accent-orange);
}

.msg-footer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.8rem;
}

.msg-action-btn:hover {
  color: var(--accent-orange);
}

/* Markdown Rendering Helpers */
.md-h2 {
  margin: 14px 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}

.md-h3 {
  margin: 12px 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.md-h4 {
  margin: 10px 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-orange);
}

.md-quote {
  border-left: 3px solid var(--accent-orange);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--text-secondary);
  font-style: italic;
  background: rgba(240, 101, 34, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.md-list-item {
  margin: 4px 0;
  padding-left: 6px;
  list-style-type: disc;
}

.table-scroll-wrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.md-table th, .md-table td {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  text-align: left;
}

.md-table th {
  background: var(--bg-dark-hover);
  font-weight: 700;
  color: var(--text-primary);
}

.md-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.dock-btn.mic-active {
  background: #ef4444 !important;
  color: #fff !important;
  animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* TYPING BAR */
.typing-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 8px;
  width: 100%;
}

.typing-bar.hidden { display: none; }

.typing-bar ugo-mascot {
  width: 26px;
  height: auto;
  color: var(--accent-orange, #f97316);
  flex-shrink: 0;
  display: inline-block;
  margin-right: 4px;
}

.typing-dots .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-orange);
  animation: typingGlow 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dots .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingGlow {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.typing-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* FLOATING BOTTOM INPUT DOCK */
.input-dock-wrapper {
  padding: 12px 24px 20px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.input-dock {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 8px 12px 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s ease;
}

.input-dock:focus-within {
  border-color: var(--border-focus);
}

.input-dock textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  resize: none;
  max-height: 140px;
  min-height: 24px;
  line-height: 1.4;
}

.dock-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.dock-btn:hover {
  background: var(--bg-dark-hover);
  color: var(--text-primary);
}

.dock-btn.send-btn {
  background: var(--accent-orange);
  color: #FFF;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(240, 101, 34, 0.25);
}

.dock-btn.send-btn:hover {
  background: #D95413;
  transform: translateY(-1px);
}

.input-disclaimer {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 8px;
}

/* ATTACHED FILE PREVIEW PILL */
.dock-file-preview {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 8px;
  font-size: 0.85rem;
  color: #f97316;
}

.dock-file-preview.hidden,
.hidden {
  display: none !important;
}

/* OTHER MODULE VIEWS */
.view-header {
  padding: 32px 32px 16px;
  border-bottom: 1px solid var(--border-light);
}

.view-header h2 { font-family: var(--font-title); font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.view-header p { color: var(--text-secondary); font-size: 0.95rem; }

/* LIVE VISION MODULE */
.live-workspace-container {
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.live-viewport-box {
  flex: 1;
  background: #000;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-placeholder-screen { text-align: center; color: var(--text-secondary); }
.camera-icon-glow { font-size: 3.5rem; color: var(--accent-cyan); margin-bottom: 16px; }

.live-viewport-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.live-hud-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.live-shutter-flash {
  position: absolute;
  inset: 0;
  background: #FFF;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.15s ease-out;
}
.live-shutter-flash.flash {
  opacity: 0.85;
  transition: none;
}

.hud-top-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}
.hud-top-bar > * {
  pointer-events: auto;
}

.hud-scanner-line {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  box-shadow: 0 0 15px var(--accent-cyan);
  animation: scan 3s ease-in-out infinite;
  z-index: 6;
}

@keyframes scan { 0% { top: 0; } 50% { top: 98%; } 100% { top: 0; } }

.hud-box { position: absolute; border: 2px solid var(--accent-cyan); border-radius: 6px; background: rgba(0, 240, 255, 0.1); }
.box-a { top: 20%; left: 25%; width: 160px; height: 120px; }
.box-b { top: 50%; left: 60%; width: 110px; height: 110px; border-color: var(--accent-orange); }

.hud-box-tag { position: absolute; top: -24px; left: 0; background: var(--bg-dark-base); color: #FFF; font-family: var(--font-code); font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; }

.hud-status-chip {
  background: rgba(14, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-code);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hud-quick-tools {
  display: flex;
  gap: 8px;
}

.hud-icon-btn {
  background: rgba(14, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  color: #FFF;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hud-icon-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: scale(1.05);
}
.hud-icon-btn.active {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #FFF;
}

.hud-mascot-observer {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 60px;
  height: 60px;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}
.hud-mascot-observer:hover {
  transform: scale(1.1);
}

/* Detected Objects Strip */
.live-detected-strip-wrapper {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.live-detected-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-detected-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
}
.detected-placeholder-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}
.detected-object-badge {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #FFF;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.detected-object-badge:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}
.badge-confidence {
  font-family: var(--font-code);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Analysis Panel */
.live-analysis-panel {
  margin-top: 10px;
  animation: fadeIn 0.3s ease-out;
}
.analysis-result-card {
  background: var(--bg-dark-card);
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.analysis-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 14px;
}
.analysis-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}
.analysis-card-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .analysis-card-body {
    grid-template-columns: 1fr;
  }
}
.analysis-snapshot-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.analysis-snapshot-img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.snapshot-badge-footer {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  font-family: var(--font-code);
}
.analysis-text-col {
  overflow-y: auto;
  max-height: 380px;
  padding-right: 8px;
}
.analysis-markdown-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}
.analysis-markdown-content h1,
.analysis-markdown-content h2,
.analysis-markdown-content h3,
.analysis-markdown-content h4 {
  color: var(--accent-cyan);
  margin-top: 12px;
  margin-bottom: 6px;
}
.analysis-markdown-content ul,
.analysis-markdown-content ol {
  margin-left: 20px;
  margin-bottom: 12px;
}
.analysis-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}
.analysis-loading-state,
.analysis-error-state {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
}
.analysis-loading-state h4,
.analysis-error-state h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.analysis-loading-state p,
.analysis-error-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.glow-cyan {
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}
.glow-cyan:hover {
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
}

.live-actions-bar { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

/* MEMORY & TROPHIES MODULE */
.memory-workspace-grid {
  flex: 1; padding: 24px 32px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  overflow-y: auto;
}

.memory-card-panel {
  background: var(--bg-dark-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 24px;
}

.memory-card-panel h3 { font-size: 1.1rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

.memory-items-container { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.memory-item-row { display: flex; align-items: center; justify-content: space-between; padding: 12px; background: var(--bg-dark-input); border-radius: var(--radius-md); }

.memory-add-form { display: flex; gap: 10px; }
.memory-add-form input { flex: 1; background: var(--bg-dark-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 10px 14px; color: var(--text-primary); }

.trophies-container { display: flex; flex-direction: column; gap: 14px; }
.trophy-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-md); background: var(--bg-dark-input); border: 1px solid var(--border-light); }
.trophy-item.unlocked { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.trophy-item.locked { opacity: 0.5; }

.trophy-icon { font-size: 1.5rem; color: var(--accent-gold); }
.trophy-name { font-weight: 700; font-size: 0.9rem; }
.trophy-desc { font-size: 0.78rem; color: var(--text-secondary); }

/* NOTES MODULE */
.notes-workspace-container { flex: 1; padding: 24px 32px; overflow-y: auto; }
.create-note-box { display: flex; flex-direction: column; gap: 12px; background: var(--bg-dark-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 28px; }
.create-note-box input, .create-note-box textarea { background: var(--bg-dark-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 12px; color: var(--text-primary); font-family: var(--font-sans); }

.notes-grid-display { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.note-item-card { background: var(--bg-dark-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 18px; }

/* ==========================================================================
   UNIVERSAL BUTTON SYSTEM & SETTINGS MODULE (SOVEREIGN UI)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #031124;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7dd3fc, var(--accent-cyan));
  color: #031124;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background: rgba(32, 38, 52, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: var(--bg-dark-hover);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.15);
}

.btn-usso-action {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.btn-usso-action:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

/* SETTINGS PROFILE HERO */
.settings-profile-hero {
  background: linear-gradient(135deg, rgba(25, 30, 40, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}
.settings-profile-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 220px; height: 100%;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 70%);
  pointer-events: none;
}
.profile-hero-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.profile-hero-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid var(--accent-cyan);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}
.profile-hero-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.profile-hero-email {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.profile-hero-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}
.status-dot-warning {
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* SETTINGS GROUP CARDS */
.settings-workspace-list {
  flex: 1;
  padding: 24px 32px;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group-card {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}
.settings-group-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.settings-group-header {
  padding: 13px 20px;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.settings-group-body {
  display: flex;
  flex-direction: column;
}

.settings-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  gap: 20px;
}
.settings-item-row:last-child {
  border-bottom: none;
}
.settings-item-info {
  flex: 1;
  min-width: 0;
}
.settings-item-title {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.settings-item-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.settings-item-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* CUSTOM STYLED SELECT */
.custom-select-styled {
  background-color: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 36px 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  transition: all 0.2s ease;
  min-width: 220px;
}
.custom-select-styled:focus, .custom-select-styled:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}

/* THEME PILLS SELECTOR */
.theme-selector-pills {
  display: inline-flex;
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.theme-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.theme-pill-btn.active {
  background: var(--bg-dark-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.theme-pill-btn:hover:not(.active) {
  color: var(--text-primary);
}

/* PASSWORD INPUT WITH ACTION */
.input-with-action {
  display: flex;
  align-items: center;
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2px 4px 2px 12px;
  gap: 6px;
  transition: border-color 0.2s ease;
}
.input-with-action:focus-within {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}
.input-with-action input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.86rem;
  min-width: 170px;
  padding: 6px 0;
}
.input-with-action .btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}
.input-with-action .btn-icon:hover {
  color: var(--text-primary);
}

.select-field, .input-field {
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  outline: none;
}

/* MODALS */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; z-index: 5000; }
.modal-backdrop.hidden { display: none; }
.modal-box { background: var(--bg-dark-card); border: 1px solid var(--border-light); border-radius: var(--radius-xl); width: 100%; max-width: 440px; padding: 28px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title-text { font-family: var(--font-title); font-size: 1.2rem; font-weight: 700; }
.input-group { margin-top: 14px; }
.input-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; }
.input-group input { width: 100%; background: var(--bg-dark-input); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 10px 14px; color: var(--text-primary); }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* EXPORT DROPDOWN MENU */
.export-selector-wrapper { position: relative; }
.export-dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-dark-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 6px; min-width: 200px;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden;
  transform: translateY(-8px); transition: all 0.2s ease; z-index: 200;
}
.export-selector-wrapper.open .export-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.export-opt {
  width: 100%; background: none; border: none; color: var(--text-secondary);
  padding: 8px 12px; text-align: left; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 8px;
}
.export-opt:hover { background: var(--bg-dark-hover); color: var(--text-primary); }

/* CLOUD SYNC BADGES */
.badge-status-offline { color: var(--text-tertiary); font-weight: 600; }
.badge-status-online { color: var(--accent-green); font-weight: 600; }

/* LIVE VOICE INTERACTIVE FULLSCREEN SCREEN */
.live-voice-screen {
  position: relative; width: 100%; height: 100%;
  background: radial-gradient(circle at center, #111827 0%, #05070A 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 40px 24px; box-sizing: border-box; overflow: hidden;
}
.live-voice-close-btn {
  position: absolute; top: 24px; right: 24px;
  background: rgba(255,255,255,0.08); border: none; color: #FFF;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.live-voice-status-bar { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; color: var(--accent-cyan); font-weight: 500; }
.live-status-dot.pulse {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan); animation: pulseDot 1.5s infinite ease-in-out;
}
@keyframes pulseDot { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.3); } }

.visualizer-container {
  position: relative; width: 320px; height: 320px;
  display: flex; align-items: center; justify-content: center;
}
#live-audio-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; }
.visualizer-center-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-purple));
  display: flex; align-items: center; justify-content: center; color: #FFF;
  font-size: 2.5rem; box-shadow: 0 0 50px var(--accent-orange-glow);
  z-index: 10; transition: transform 0.1s ease;
}

.live-transcript-box {
  width: 100%; max-width: 600px; max-height: 120px; overflow-y: auto;
  text-align: center; font-size: 1.05rem; color: var(--text-primary);
  line-height: 1.5; background: rgba(255,255,255,0.03); padding: 16px;
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
}
.live-transcript-box .placeholder { color: var(--text-tertiary); font-size: 0.9rem; }

.live-controls-bar { display: flex; align-items: center; gap: 24px; }
.live-ctrl-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-dark-card); border: 1px solid var(--border-light);
  color: var(--text-primary); font-size: 1.3rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;
}
.live-ctrl-btn.active { background: rgba(0, 240, 255, 0.15); border-color: var(--accent-cyan); color: var(--accent-cyan); }
.live-ctrl-btn.end-call { background: #EF4444; border: none; color: #FFF; box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }

/* MEDIA LIGHTBOX */
.lightbox-content {
  position: relative; max-width: 90vw; max-height: 85vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#lightbox-img-element { max-width: 100%; max-height: 75vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); object-fit: contain; }
.lightbox-close-btn {
  position: absolute; top: -40px; right: 0; background: none; border: none;
  color: #FFF; font-size: 1.5rem; cursor: pointer;
}
.lightbox-toolbar { margin-top: 16px; display: flex; gap: 12px; }

/* MCP MODAL & SWITCHES */
.modal-box.modal-lg { max-width: 600px; }
.mcp-tools-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.mcp-tool-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; background: var(--bg-dark-input); border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}
.mcp-tool-info { display: flex; flex-direction: column; gap: 2px; }
.mcp-tool-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.mcp-tool-desc { font-size: 0.78rem; color: var(--text-secondary); }

/* TOGGLE SWITCH STYLES */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151; transition: .3s; border-radius: 24px;
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-orange); }
input:checked + .slider:before { transform: translateX(20px); }

/* SIDEBAR BACKDROP OVERLAY FOR MOBILE */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* RESPONSIVE DESIGN */
.mobile-only { display: none; }

@media (max-width: 768px) {
  .mobile-only { display: flex !important; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1000;
    transform: translateX(-100%);
    margin-left: 0;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* WORKSPACE HEADER MOBILE */
  .workspace-header {
    height: 52px;
    padding: 0 12px;
    flex-shrink: 0;
  }

  .header-left {
    gap: 10px;
  }

  .header-right {
    gap: 8px;
  }

  .workspace-brand .brand-title {
    font-size: 1.15rem;
  }

  #header-usso-text {
    display: none !important;
  }

  .btn-usso {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: none;
  }

  .icon-btn-ghost {
    width: 36px;
    height: 36px;
  }

  /* WELCOME SCREEN MOBILE */
  .chat-welcome-container {
    padding: 16px 12px;
  }

  .welcome-hero {
    margin-bottom: 24px;
  }

  .welcome-orb {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    margin-bottom: 12px;
  }

  .welcome-title {
    font-size: 1.45rem;
  }

  .welcome-subtitle {
    font-size: 0.88rem;
  }

  .prompt-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .prompt-card {
    padding: 14px;
  }

  /* CHAT THREAD & MESSAGES MOBILE */
  .chat-thread-container {
    padding: 6px 8px calc(85px + env(safe-area-inset-bottom, 0px));
  }

  .chat-thread-header {
    padding: 6px 10px;
    margin-bottom: 12px;
  }

  .chat-thread-title {
    max-width: 170px;
    font-size: 0.84rem;
  }

  .messages-stream {
    gap: 14px;
  }

  .message-row {
    gap: 8px;
  }

  .msg-avatar-badge {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .msg-body {
    max-width: 90%;
  }

  .msg-bubble {
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 14px;
  }

  .msg-user-row .msg-bubble {
    border-top-right-radius: 4px;
  }

  .msg-ugo-row .msg-bubble {
    border-top-left-radius: 4px;
  }

  .msg-footer-bar {
    font-size: 0.7rem;
    margin-top: 3px;
  }

  .msg-bubble pre {
    padding: 10px;
    font-size: 0.78rem;
    margin: 8px 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .code-header-bar {
    padding: 4px 8px;
    margin: -10px -10px 8px -10px;
    font-size: 0.7rem;
  }

  /* INPUT DOCK MOBILE */
  .input-dock-wrapper {
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    box-sizing: border-box;
  }

  .input-dock {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 20px;
  }

  .dock-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  .dock-btn.send-btn {
    width: 34px;
    height: 34px;
  }

  .input-dock textarea {
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    padding: 2px 2px;
    max-height: 100px;
  }

  .input-disclaimer {
    font-size: 0.68rem;
    line-height: 1.25;
    margin-top: 4px;
    padding: 0 4px;
  }

  .typing-bar {
    padding: 0 12px 6px;
  }

  /* SUB-MODULE VIEWS MOBILE */
  .view-header {
    padding: 16px 14px 12px;
  }

  .view-header h2 {
    font-size: 1.25rem;
  }

  .view-header p {
    font-size: 0.85rem;
  }

  .live-workspace-container {
    padding: 12px;
    gap: 12px;
  }

  .live-actions-bar {
    flex-direction: column;
    gap: 10px;
  }

  .live-actions-bar .btn {
    width: 100%;
  }

  .memory-workspace-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 14px;
  }

  .memory-card-panel {
    padding: 16px;
  }

  .memory-add-form {
    flex-direction: column;
  }

  .memory-add-form .btn {
    width: 100%;
  }

  .notes-workspace-container {
    padding: 12px;
  }

  .create-note-box {
    padding: 14px;
    margin-bottom: 16px;
  }

  .notes-grid-display {
    grid-template-columns: 1fr;
  }

  .settings-workspace-list {
    padding: 12px;
    gap: 16px;
  }

  .settings-profile-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 16px;
  }
  .settings-profile-hero .profile-hero-actions {
    width: 100%;
  }
  .settings-profile-hero .btn {
    width: 100%;
  }

  .settings-item-row {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
  }

  .settings-item-control {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .settings-item-control .custom-select-styled,
  .settings-item-control .input-with-action,
  .settings-item-control .theme-selector-pills,
  .settings-item-control .btn {
    width: 100%;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
  }

  .setting-row .select-field,
  .setting-row .input-field,
  .setting-row .btn {
    width: 100%;
  }

  .modal-box {
    width: 92%;
    padding: 20px;
    margin: 0 16px;
  }
}

/* ULTRA-SMALL DEVICES (<= 420px) */
@media (max-width: 420px) {
  .workspace-header {
    padding: 0 6px;
  }

  .header-left, .header-right {
    gap: 4px;
  }

  .model-select-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    max-width: 120px;
  }

  #selected-model-name {
    max-width: 65px;
  }

  .msg-body {
    max-width: 92%;
  }

  .input-dock {
    gap: 4px;
    padding: 4px 6px;
  }

  .dock-btn {
    width: 30px;
    height: 30px;
  }
}

/* CTA & PWA MODAL STYLES */
.btn-app-cta {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  color: var(--accent-orange);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-app-cta:hover {
  background: var(--bg-dark-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.modal-pwa-box {
  max-width: 580px;
}

.pwa-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.pwa-card {
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pwa-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.pwa-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.pwa-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

.btn-block {
  width: 100%;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
}

.pwa-ios-hint {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

@media (max-width: 640px) {
  .pwa-options-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   UGO ROBOT ANIMATIONS & INTERACTIVE MINI THEATER STYLES (Ugo's.ai)
   ========================================================================== */

/* Triggers & Base SVG styling */
.ugo-trigger {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  user-select: none;
}

.ugo-trigger:hover {
  transform: scale(1.1) translateY(-3px) !important;
  filter: drop-shadow(0 6px 16px rgba(240, 101, 34, 0.5));
}

.ugo-trigger:active {
  transform: scale(0.95) !important;
}

/* Center Welcome Badge Float Animation */
.welcome-logo-badge {
  animation: ugo-container-float 3.5s ease-in-out infinite !important;
}

@keyframes ugo-container-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-6px) rotate(-1.5deg);
  }
}

/* Base SVG Robot Keyframes & Transforms */
.ugo-svg-robot {
  overflow: visible !important;
}

.ugo-head-group,
.ugo-body-group,
.ugo-face-group,
.ugo-eye,
.ugo-eye-circle,
.ugo-mouth,
.ugo-collar,
.ugo-head-ring {
  transform-box: fill-box;
  transform-origin: center;
}

.ugo-head-group {
  animation: ugo-idle-float 4s ease-in-out infinite;
}

.ugo-eye {
  animation: ugo-eye-blink 3.5s ease-in-out infinite;
}

.ugo-eye-left {
  animation-delay: 0.05s;
}

.ugo-eye-right {
  animation-delay: 0.05s;
}

.ugo-mouth {
  transition: transform 0.2s ease, fill 0.2s ease;
}

/* Base Animations */
@keyframes ugo-idle-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(-2deg);
  }
}

@keyframes ugo-eye-blink {
  0%, 92%, 97%, 100% {
    transform: scaleY(1);
    opacity: 1;
  }
  95% {
    transform: scaleY(0.05);
    opacity: 0.4;
  }
}

/* STATE: Thinking / Loading */
.ugo-svg-robot.ugo-thinking .ugo-head-group {
  animation: ugo-think-wobble 1.2s ease-in-out infinite alternate;
}

.ugo-svg-robot.ugo-thinking .ugo-eye {
  animation: ugo-think-eyes 0.8s ease-in-out infinite alternate;
}

@keyframes ugo-think-wobble {
  0% { transform: translateY(-2px) rotate(-4deg); }
  100% { transform: translateY(-6px) rotate(4deg); }
}

@keyframes ugo-think-eyes {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

/* STATE: Speaking */
.ugo-svg-robot.ugo-speaking .ugo-mouth {
  animation: ugo-talk-mouth 0.35s ease-in-out infinite alternate;
}

@keyframes ugo-talk-mouth {
  0% { transform: scale(0.8); }
  100% { transform: scale(1.4); }
}

/* STATE: Dancing */
.ugo-svg-robot.ugo-dancing .ugo-head-group {
  animation: ugo-dance-head 0.5s ease-in-out infinite alternate;
}

@keyframes ugo-dance-head {
  0% { transform: translateY(-8px) rotate(-10deg) scale(1.05); }
  100% { transform: translateY(2px) rotate(10deg) scale(0.95); }
}

/* STATE: Sleeping */
.ugo-svg-robot.ugo-sleeping .ugo-head-group {
  animation: ugo-sleep-float 3s ease-in-out infinite;
}

.ugo-svg-robot.ugo-sleeping .ugo-eye {
  transform: scaleY(0.15) !important;
  animation: none !important;
}

@keyframes ugo-sleep-float {
  0%, 100% { transform: translateY(6px) rotate(6deg); }
  50% { transform: translateY(10px) rotate(8deg); }
}

/* STATE: Rocket Flight */
.ugo-svg-robot.ugo-rocket .ugo-head-group {
  animation: ugo-rocket-spin 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

@keyframes ugo-rocket-spin {
  0% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-20px) scale(1.15) rotate(-360deg); }
  100% { transform: translateY(0) scale(1) rotate(-720deg); }
}

/* ==========================================================================
   MINI THEATER OVERLAY CONTAINER & MODAL
   ========================================================================== */

.ugo-theater-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ugo-theater-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ugo-theater-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.ugo-theater-stage-container {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 580px;
  perspective: 1000px;
}

.ugo-theater-stage {
  position: relative;
  background: linear-gradient(145deg, rgba(26, 31, 46, 0.95), rgba(15, 18, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(240, 101, 34, 0.15);
  overflow: hidden;
  animation: ugo-stage-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ugo-stage-pop {
  0% { transform: scale(0.8) translateY(30px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.ugo-theater-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ugo-theater-close:hover {
  background: rgba(239, 68, 68, 0.8);
  color: white;
  transform: rotate(90deg) scale(1.1);
}

/* Spotlights & Stage Effects */
.ugo-spotlight {
  position: absolute;
  top: -100px;
  width: 220px;
  height: 350px;
  pointer-events: none;
  opacity: 0.35;
  filter: blur(25px);
}

.left-spotlight {
  left: -40px;
  background: conic-gradient(from 135deg at 50% 0%, rgba(56, 189, 248, 0.6), transparent 60deg);
  transform: rotate(-15deg);
}

.right-spotlight {
  right: -40px;
  background: conic-gradient(from 225deg at 50% 0%, rgba(240, 101, 34, 0.6), transparent 60deg);
  transform: rotate(15deg);
}

.ugo-stage-glow {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 60px;
  background: radial-gradient(ellipse at center, rgba(240, 101, 34, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

/* Dynamic Speech Bubble */
.ugo-speech-bubble {
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(243, 244, 246, 0.95));
  color: #111827;
  padding: 12px 20px;
  border-radius: 20px;
  border-bottom-left-radius: 4px;
  font-weight: 600;
  font-size: 0.98rem;
  max-width: 90%;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  animation: ugo-bubble-bounce 3s ease-in-out infinite;
  z-index: 4;
}

.ugo-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 30px;
  border-width: 10px 10px 0 0;
  border-style: solid;
  border-color: rgba(243, 244, 246, 0.95) transparent transparent transparent;
}

@keyframes ugo-bubble-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Hero Avatar Wrapper */
.ugo-hero-avatar-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ugo-animated-hero {
  width: 130px;
  height: 130px;
  color: var(--text-primary);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
  z-index: 3;
}

.ugo-hero-avatar-wrapper ugo-mascot {
  width: 140px;
  height: auto;
  color: var(--accent-orange, #f97316);
  filter: drop-shadow(0 10px 24px rgba(240, 101, 34, 0.35));
  z-index: 3;
  display: block;
}

.ugo-aura-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px stroke transparent;
  background: radial-gradient(circle, rgba(240, 101, 34, 0.4) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.ugo-hero-avatar-wrapper.power .ugo-aura-ring {
  opacity: 1;
  animation: ugo-power-aura 1s ease-in-out infinite alternate;
}

@keyframes ugo-power-aura {
  0% { transform: scale(0.9); opacity: 0.4; filter: blur(4px); }
  100% { transform: scale(1.25); opacity: 0.9; filter: blur(10px); }
}

/* Floating Zzz for Sleep */
.ugo-zzz-container {
  position: absolute;
  top: -20px;
  right: 10px;
  pointer-events: none;
  z-index: 5;
}

.ugo-zzz-letter {
  position: absolute;
  font-weight: 900;
  color: #38bdf8;
  opacity: 0;
  animation: ugo-zzz-rise 2s ease-in infinite;
}

@keyframes ugo-zzz-rise {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  50% { opacity: 0.9; }
  100% { transform: translate(25px, -45px) scale(1.2); opacity: 0; }
}

/* Titles */
.ugo-theater-title {
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.ugo-theater-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

/* Action Buttons Grid */
.ugo-theater-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.ugo-act-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ugo-act-btn:hover {
  background: rgba(240, 101, 34, 0.2);
  border-color: rgba(240, 101, 34, 0.5);
  color: #ffffff;
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 18px rgba(240, 101, 34, 0.25);
}

.ugo-act-btn:active {
  transform: translateY(0) scale(0.96);
}

.ugo-act-btn.active {
  background: var(--gradient-primary, linear-gradient(135deg, #f97316, #e84a1d));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(240, 101, 34, 0.4);
}

/* ==========================================================================
   UGOS.AI — MODALITÀ DUO (DUO MODE COLLABORATIVE ENGINE)
   Due utenti distinti dialogano con la stessa intelligenza artificiale Ugo
   ========================================================================== */

/* 1. Header Toggle Button */
.duo-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(192, 132, 252, 0.08);
  border: 1px solid rgba(192, 132, 252, 0.25);
  color: var(--accent-purple);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.duo-mode-toggle:hover {
  background: rgba(192, 132, 252, 0.16);
  border-color: rgba(192, 132, 252, 0.5);
  transform: translateY(-1px);
}

.duo-mode-toggle.active {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.25), rgba(56, 189, 248, 0.2));
  border-color: rgba(192, 132, 252, 0.6);
  color: #f3f4f6;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.3);
}

.duo-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
  transition: background 0.2s ease;
}

.duo-mode-toggle.active .duo-status-indicator {
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

/* Sidebar New Duo Button */
.btn-sidebar-duo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(192, 132, 252, 0.08);
  border: 1px dashed rgba(192, 132, 252, 0.35);
  color: #f3f4f6;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s ease;
}

.btn-sidebar-duo:hover {
  background: rgba(192, 132, 252, 0.18);
  border-color: rgba(192, 132, 252, 0.6);
  transform: translateY(-1px);
}

.duo-mini-badge {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
}

/* Welcome Screen Duo Feature Banner */
.welcome-duo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.55), rgba(15, 23, 42, 0.75));
  border: 1px solid rgba(192, 132, 252, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin: 0 auto 24px auto;
  max-width: 680px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 16px rgba(192, 132, 252, 0.1);
}

.welcome-duo-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.welcome-duo-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.welcome-duo-text {
  min-width: 0;
}

.welcome-duo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.welcome-duo-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 2px;
}

/* 2. Duo Session Sticky Bar */
.duo-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, rgba(19, 23, 32, 0.95), rgba(25, 30, 42, 0.98));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(192, 132, 252, 0.22);
  padding: 8px 18px;
  position: sticky;
  top: 0;
  z-index: 15;
  animation: slideDuoBar 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDuoBar {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.duo-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.duo-title-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  color: var(--accent-purple);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.duo-pulse-icon {
  animation: pulseDuoIcon 2s infinite ease-in-out;
}

@keyframes pulseDuoIcon {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.18); opacity: 1; }
}

.duo-speakers-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.duo-speaker-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.duo-speaker-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.duo-speaker-pill.active[data-user="user1"] {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.duo-speaker-pill.active[data-user="user2"] {
  background: rgba(192, 132, 252, 0.15);
  border-color: rgba(192, 132, 252, 0.5);
  color: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.25);
}

.duo-speaker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.user1-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.user2-dot {
  background: #c084fc;
  box-shadow: 0 0 6px #c084fc;
}

.duo-speaker-tag {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-left: 2px;
}

.duo-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.duo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.duo-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.duo-action-btn.duo-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* 3. Messages Styling for Duo Mode */
/* Utente 1 (Ciano) */
.msg-user1-row .msg-avatar-badge {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
}

.msg-user1-row .msg-bubble {
  border-left: 3px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.07) !important;
  border-color: rgba(56, 189, 248, 0.2) !important;
}

.msg-user1-row .msg-sender-name {
  color: #38bdf8 !important;
  font-weight: 700;
}

.msg-user1-row .duo-user-tag {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Utente 2 (Viola) */
.msg-user2-row .msg-avatar-badge {
  background: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(192, 132, 252, 0.5) !important;
  box-shadow: 0 2px 8px rgba(192, 132, 252, 0.25);
}

.msg-user2-row .msg-bubble {
  border-left: 3px solid #c084fc !important;
  background: rgba(192, 132, 252, 0.07) !important;
  border-color: rgba(192, 132, 252, 0.2) !important;
}

.msg-user2-row .msg-sender-name {
  color: #c084fc !important;
  font-weight: 700;
}

.msg-user2-row .duo-user-tag {
  display: inline-block;
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Risposta Ugo AI in modalità Duo */
.msg-ugo-row.msg-duo-reply .msg-meta-bar::after {
  content: '👥 Dialogo a tre';
  font-size: 0.72rem;
  color: var(--accent-orange);
  background: rgba(240, 101, 34, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}

/* 4. Duo Setup & Share Modal */
.duo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInDuoModal 0.2s ease-out;
}

@keyframes fadeInDuoModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.duo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.75);
  backdrop-filter: blur(8px);
}

.duo-modal-card {
  position: relative;
  width: 100%;
  max-width: 580px;
  background: #131720;
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 24px rgba(192, 132, 252, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleDuoCard 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleDuoCard {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.duo-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.duo-modal-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.duo-modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.duo-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.duo-modal-subtitle {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.duo-modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.duo-modal-close:hover {
  color: #ffffff;
}

.duo-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 65vh;
  overflow-y: auto;
}

.duo-explainer-banner {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.83rem;
  color: #bae6fd;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}

.duo-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duo-form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.duo-participants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.duo-participant-card {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duo-participant-card.user1-card {
  border-color: rgba(56, 189, 248, 0.3);
}

.duo-participant-card.user2-card {
  border-color: rgba(192, 132, 252, 0.3);
}

.duo-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.duo-avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #ffffff;
}

.user1-bg {
  background: #0284c7;
}

.user2-bg {
  background: #7c3aed;
}

.duo-role-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.duo-input-field {
  width: 100%;
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 8px 10px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.duo-input-field:focus {
  border-color: var(--accent-cyan);
}

.duo-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.77rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 2px;
}

.duo-share-box {
  display: flex;
  gap: 8px;
}

.duo-share-input {
  flex: 1;
  background: var(--bg-dark-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: #38bdf8;
  font-family: var(--font-code);
  font-size: 0.8rem;
  padding: 9px 12px;
  outline: none;
}

.duo-copy-btn {
  white-space: nowrap;
  font-size: 0.82rem;
}

.duo-sync-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  color: #34d399;
  margin-top: 4px;
}

.duo-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
}

.pulse-dot {
  animation: pulseSyncDot 1.5s infinite;
}

@keyframes pulseSyncDot {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.7; }
}

.duo-options-group {
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

.duo-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.duo-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
}

/* Responsive Duo Bar */
@media (max-width: 640px) {
  .duo-session-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .duo-bar-left {
    justify-content: space-between;
  }
  .duo-bar-right {
    justify-content: flex-end;
  }
  .duo-participants-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   USSO MENTION & AUTOCOMPLETE SYSTEM
   Supporto ufficiale per Nickname, Tag #1234 e Codice UnHub ID
   ========================================================================== */

.duo-mention-card-box {
  background: rgba(14, 165, 233, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
}

.duo-mention-input-row {
  display: flex;
  gap: 8px;
}

.duo-mention-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.duo-at-icon {
  position: absolute;
  left: 12px;
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: none;
}

.duo-mention-field {
  padding-left: 28px !important;
  font-family: var(--font-code);
  font-size: 0.85rem !important;
}

.duo-mention-btn {
  white-space: nowrap;
  font-size: 0.82rem;
}

.duo-mention-resolved-card {
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInDuoModal 0.2s ease;
}

.duo-resolved-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.duo-resolved-meta {
  flex: 1;
  min-width: 0;
}

.duo-resolved-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.85rem;
}

.duo-resolved-tag {
  color: #38bdf8;
  font-family: var(--font-code);
  font-size: 0.78rem;
  font-weight: 600;
}

.duo-resolved-id {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Floating Inline Mentions Dropdown */
.mention-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 20px;
  right: 20px;
  max-width: 420px;
  background: #131720;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  z-index: 50;
  animation: scaleDuoCard 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.mention-header {
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mention-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  width: 100%;
}

.mention-item:hover, .mention-item.selected {
  background: rgba(56, 189, 248, 0.12);
  color: #ffffff;
}

.mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.mention-user-info {
  flex: 1;
  min-width: 0;
}

.mention-nick {
  font-weight: 600;
}

.mention-tag {
  color: #38bdf8;
  font-family: var(--font-code);
  font-size: 0.75rem;
  margin-left: 4px;
}

.mention-type {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Inline Mention Badge in Messages */
.usso-mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-family: var(--font-code);
  font-size: 0.85em;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
}






