/* ============================================================================
   OmniAI — Professional Design System
   Inspired by Claude's refined minimalism
   ============================================================================ */

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

   /* ============================================================================
      Design Tokens
      ============================================================================ */
   
   :root {
       /* Typography */
       --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
   
       /* Dark Mode (Default) */
       --bg-primary: #1a1a1f;
       --bg-secondary: #222228;
       --bg-tertiary: #2a2a32;
       --bg-elevated: #2e2e38;
       --bg-hover: #32323c;
       --bg-input: #26262e;
   
       --text-primary: #ececf0;
       --text-secondary: #a8a8b3;
       --text-tertiary: #6c6c7a;
       --text-inverse: #1a1a1f;
   
       --border-primary: #35353f;
       --border-secondary: #2e2e38;
       --border-focus: #7c6cf0;
   
       --accent-primary: #7c6cf0;
       --accent-hover: #6b5ce0;
       --accent-subtle: rgba(124, 108, 240, 0.12);
       --accent-text: #a599f5;
   
       --success: #34c759;
       --warning: #f0a030;
       --danger: #ef4444;
       --info: #60a5fa;
   
       --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
       --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
       --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);
       --shadow-glow: 0 0 0 3px rgba(124, 108, 240, 0.15);
   
       --radius-sm: 8px;
       --radius-md: 12px;
       --radius-lg: 16px;
       --radius-xl: 24px;
       --radius-full: 9999px;
   
       --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
       --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
       --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
   
       --chat-max-width: 768px;
       --sidebar-width: 280px;
       --header-height: 56px;
   }
   
   /* Light Mode */
   .light-mode {
       --bg-primary: #faf9f7;
       --bg-secondary: #ffffff;
       --bg-tertiary: #f2f0ec;
       --bg-elevated: #ffffff;
       --bg-hover: #eeece8;
       --bg-input: #ffffff;
   
       --text-primary: #1a1a1f;
       --text-secondary: #5a5a66;
       --text-tertiary: #8a8a96;
       --text-inverse: #ffffff;
   
       --border-primary: #e2e0dc;
       --border-secondary: #eae8e4;
       --border-focus: #7c6cf0;
   
       --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
       --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
       --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
   }
   
   /* ============================================================================
      Reset & Base
      ============================================================================ */
   
   *, *::before, *::after {
       box-sizing: border-box;
       margin: 0;
       padding: 0;
   }
   
   html {
       font-size: 16px;
       -webkit-font-smoothing: antialiased;
       -moz-osx-font-smoothing: grayscale;
       text-rendering: optimizeLegibility;
   }
   
   body {
       font-family: var(--font-primary);
       background: var(--bg-primary);
       color: var(--text-primary);
       line-height: 1.6;
       height: 100vh;
       overflow: hidden;
       transition: background var(--transition-normal), color var(--transition-normal);
   }
   
   ::selection {
       background: var(--accent-subtle);
       color: var(--accent-text);
   }
   
   ::-webkit-scrollbar {
       width: 6px;
   }
   
   ::-webkit-scrollbar-track {
       background: transparent;
   }
   
   ::-webkit-scrollbar-thumb {
       background: var(--text-tertiary);
       border-radius: var(--radius-full);
   }
   
   ::-webkit-scrollbar-thumb:hover {
       background: var(--text-secondary);
   }
   
   /* ============================================================================
      Header
      ============================================================================ */
   
   .header {
       height: var(--header-height);
       display: flex;
       align-items: center;
       justify-content: space-between;
       padding: 0 16px;
       background: var(--bg-secondary);
       border-bottom: 1px solid var(--border-secondary);
       position: relative;
       z-index: 100;
       flex-shrink: 0;
   }
   
   .header-left {
       display: flex;
       align-items: center;
       gap: 12px;
   }
   
   .header-right {
       display: flex;
       align-items: center;
       gap: 8px;
   }
   
   .logo {
       font-size: 17px;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.3px;
       display: flex;
       align-items: center;
       gap: 8px;
   }
   
   .sidebar-toggle {
       width: 36px;
       height: 36px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: none;
       border: none;
       color: var(--text-secondary);
       cursor: pointer;
       border-radius: var(--radius-sm);
       font-size: 18px;
       transition: all var(--transition-fast);
   }
   
   .sidebar-toggle:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
   }
   
   .theme-toggle,
   .files-toggle {
       width: 36px;
       height: 36px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: none;
       border: 1px solid var(--border-primary);
       color: var(--text-secondary);
       cursor: pointer;
       border-radius: var(--radius-sm);
       font-size: 16px;
       transition: all var(--transition-fast);
   }
   
   .theme-toggle:hover,
   .files-toggle:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
       border-color: var(--text-tertiary);
   }
   
   .new-chat-btn {
       padding: 8px 16px;
       background: var(--accent-primary);
       color: white;
       border: none;
       border-radius: var(--radius-sm);
       font-size: 13px;
       font-weight: 600;
       font-family: var(--font-primary);
       cursor: pointer;
       transition: all var(--transition-fast);
       letter-spacing: -0.1px;
   }
   
   .new-chat-btn:hover {
       background: var(--accent-hover);
       transform: translateY(-1px);
       box-shadow: var(--shadow-md);
   }
   
   .new-chat-btn:active {
       transform: translateY(0);
   }
   
   /* ============================================================================
      Main Layout
      ============================================================================ */
   
   .main-container {
       display: flex;
       height: calc(100vh - var(--header-height));
       overflow: hidden;
   }
   
   /* ============================================================================
      Sidebar
      ============================================================================ */
   
   .sidebar {
       width: var(--sidebar-width);
       background: var(--bg-secondary);
       border-right: 1px solid var(--border-secondary);
       display: flex;
       flex-direction: column;
       flex-shrink: 0;
       transition: width var(--transition-normal), transform var(--transition-normal);
       overflow: hidden;
   }
   
   .sidebar.hidden {
       width: 0;
       border-right: none;
       overflow: hidden;
   }
   
   .sidebar-header {
       padding: 16px;
       flex-shrink: 0;
   }
   
   .sidebar-title {
       font-size: 13px;
       font-weight: 600;
       color: var(--text-tertiary);
       text-transform: uppercase;
       letter-spacing: 0.8px;
       margin-bottom: 12px;
   }
   
   .search-box {
       width: 100%;
       padding: 9px 12px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 13px;
       font-family: var(--font-primary);
       outline: none;
       transition: all var(--transition-fast);
   }
   
   .search-box:focus {
       border-color: var(--border-focus);
       box-shadow: var(--shadow-glow);
   }
   
   .search-box::placeholder {
       color: var(--text-tertiary);
   }
   
   .conversations-list {
       flex: 1;
       overflow-y: auto;
       padding: 4px 8px;
   }
   
   .conversation-item {
       display: flex;
       flex-direction: column;
       padding: 10px 12px;
       margin-bottom: 2px;
       border-radius: var(--radius-sm);
       position: relative;
       cursor: pointer;
       transition: all var(--transition-fast);
       border: 1px solid transparent;
   }
   
   .conversation-item:hover {
       background: var(--bg-hover);
   }
   
   .conversation-item.active {
       background: var(--accent-subtle);
       border-color: rgba(124, 108, 240, 0.2);
   }
   
   .conversation-title {
       font-size: 13.5px;
       font-weight: 500;
       color: var(--text-primary);
       white-space: nowrap;
       overflow: hidden;
       text-overflow: ellipsis;
       line-height: 1.4;
   }
   
   .conversation-meta {
       font-size: 11.5px;
       color: var(--text-tertiary);
       margin-top: 2px;
   }
   
   .conversation-time {
       font-size: 11.5px;
       color: var(--text-tertiary);
       margin-top: 2px;
   }
   
   .title-input {
       font-size: 13.5px;
       font-weight: 500;
       font-family: var(--font-primary);
       color: var(--text-primary);
       background: var(--bg-input);
       border: 1px solid var(--border-focus);
       border-radius: 6px;
       padding: 4px 8px;
       width: 100%;
       outline: none;
       box-shadow: var(--shadow-glow);
   }
   
   .conversation-actions {
       position: absolute;
       right: 8px;
       top: 50%;
       transform: translateY(-50%);
       display: flex;
       gap: 2px;
       opacity: 0;
       transition: opacity var(--transition-fast);
   }
   
   .conversation-item:hover .conversation-actions {
       opacity: 1;
   }
   
   .conv-action-btn {
       width: 28px;
       height: 28px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: 6px;
       cursor: pointer;
       font-size: 12px;
       transition: all var(--transition-fast);
       color: var(--text-secondary);
   }
   
   .conv-action-btn:hover {
       background: var(--bg-primary);
       border-color: var(--text-tertiary);
   }
   
   .edit-btn,
   .delete-btn {
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       color: var(--text-secondary);
       width: 26px;
       height: 26px;
       border-radius: 6px;
       cursor: pointer;
       font-size: 13px;
       display: flex;
       align-items: center;
       justify-content: center;
       transition: all var(--transition-fast);
   }
   
   .edit-btn:hover {
       background: var(--accent-subtle);
       color: var(--accent-primary);
       border-color: var(--accent-primary);
   }
   
   .delete-btn:hover {
       background: rgba(239, 68, 68, 0.1);
       color: var(--danger);
       border-color: var(--danger);
   }
   
   .files-toggle.active {
       background: var(--accent-primary);
       color: white;
       border-color: var(--accent-primary);
   }
   
   .no-conversations,
   .empty-state {
       text-align: center;
       padding: 40px 16px;
       color: var(--text-tertiary);
       font-size: 13px;
       line-height: 1.6;
   }
   
   .sidebar-overlay {
       display: none;
       position: fixed;
       inset: 0;
       background: rgba(0, 0, 0, 0.5);
       z-index: 49;
       backdrop-filter: blur(4px);
   }
   
   .sidebar-overlay.show {
       display: block;
   }
   
   /* ============================================================================
      Files Panel
      ============================================================================ */
   
   .files-panel {
       width: var(--sidebar-width);
       background: var(--bg-secondary);
       border-right: 1px solid var(--border-secondary);
       display: flex;
       flex-direction: column;
       flex-shrink: 0;
       overflow: hidden;
   }
   
   .files-panel.hidden {
       display: none;
   }
   
   .files-panel-header {
       padding: 16px;
       display: flex;
       align-items: center;
       justify-content: space-between;
       flex-shrink: 0;
   }
   
   .files-panel-title {
       font-size: 13px;
       font-weight: 600;
       color: var(--text-tertiary);
       text-transform: uppercase;
       letter-spacing: 0.8px;
   }
   
   .files-panel-header select {
       padding: 5px 8px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: 6px;
       color: var(--text-primary);
       font-size: 12px;
       font-family: var(--font-primary);
       outline: none;
       cursor: pointer;
   }
   
   .files-search {
       padding: 0 16px 12px;
   }
   
   .file-search-input {
       width: 100%;
       padding: 8px 12px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 13px;
       font-family: var(--font-primary);
       outline: none;
       transition: all var(--transition-fast);
   }
   
   .file-search-input:focus {
       border-color: var(--border-focus);
       box-shadow: var(--shadow-glow);
   }
   
   .file-search-input::placeholder {
       color: var(--text-tertiary);
   }
   
   .files-list {
       flex: 1;
       overflow-y: auto;
       padding: 0 8px;
   }
   
   .file-card {
       padding: 10px 12px;
       margin-bottom: 6px;
       background: var(--bg-primary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       transition: all var(--transition-fast);
   }
   
   .file-card:hover {
       border-color: var(--accent-primary);
       box-shadow: var(--shadow-sm);
   }
   
   .file-card-header {
       display: flex;
       align-items: flex-start;
       gap: 10px;
   }
   
   .file-card-icon {
       font-size: 20px;
       flex-shrink: 0;
   }
   
   .file-card-info {
       flex: 1;
       min-width: 0;
   }
   
   .file-card-name {
       font-size: 13px;
       font-weight: 500;
       color: var(--text-primary);
       overflow: hidden;
       text-overflow: ellipsis;
       white-space: nowrap;
       margin-bottom: 4px;
   }
   
   .file-card-meta {
       font-size: 11px;
       color: var(--text-tertiary);
       display: flex;
       gap: 8px;
   }
   
   .file-card-actions {
       display: flex;
       gap: 4px;
       margin-top: 8px;
       padding-top: 8px;
       border-top: 1px solid var(--border-secondary);
   }
   
   .file-item {
       display: flex;
       align-items: center;
       gap: 10px;
       padding: 10px 12px;
       border-radius: var(--radius-sm);
       cursor: pointer;
       transition: all var(--transition-fast);
       margin-bottom: 2px;
   }
   
   .file-item:hover {
       background: var(--bg-hover);
   }
   
   .file-icon {
       font-size: 20px;
       flex-shrink: 0;
       width: 32px;
       text-align: center;
   }
   
   .file-info {
       flex: 1;
       min-width: 0;
   }
   
   .file-name {
       font-size: 13px;
       font-weight: 500;
       color: var(--text-primary);
       overflow: hidden;
       text-overflow: ellipsis;
       white-space: nowrap;
   }
   
   .file-meta {
       display: flex;
       gap: 8px;
       margin-top: 2px;
   }
   
   .file-size,
   .file-date,
   .file-type {
       font-size: 11px;
       color: var(--text-tertiary);
   }
   
   .file-snippet {
       font-size: 12px;
       color: var(--text-secondary);
       margin-top: 4px;
       display: -webkit-box;
       -webkit-line-clamp: 2;
       -webkit-box-orient: vertical;
       line-clamp: 2;
       box-orient: vertical;
       overflow: hidden;
   }
   
   .match-count {
       font-size: 11px;
       color: var(--accent-text);
   }
   
   .file-item.search-result {
       border-left: 3px solid var(--accent-primary);
   }
   
   .file-actions {
       display: flex;
       gap: 4px;
       opacity: 0;
       transition: opacity var(--transition-fast);
   }
   
   .file-item:hover .file-actions {
       opacity: 1;
   }
   
   .file-action-btn {
       width: 28px;
       height: 28px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: 6px;
       cursor: pointer;
       font-size: 13px;
       transition: all var(--transition-fast);
   }
   
   .file-action-btn:hover {
       background: var(--bg-primary);
   }
   
   .file-action-btn.delete:hover {
       border-color: var(--danger);
       color: var(--danger);
   }
   
   .files-stats {
       padding: 12px 16px;
       border-top: 1px solid var(--border-secondary);
   }
   
   .files-stats-grid {
       display: grid;
       grid-template-columns: 1fr 1fr;
       gap: 12px;
   }
   
   .files-stat-item {
       display: flex;
       flex-direction: column;
   }
   
   .files-stat-value {
       font-size: 16px;
       font-weight: 700;
       color: var(--text-primary);
   }
   
   .files-stat-label {
       font-size: 11px;
       color: var(--text-tertiary);
       text-transform: uppercase;
       letter-spacing: 0.5px;
   }
   
   /* ============================================================================
      Chat Area
      ============================================================================ */
   
   .chat-area {
       flex: 1;
       display: flex;
       flex-direction: column;
       min-width: 0;
       position: relative;
   }
   
   .messages-container {
       flex: 1;
       overflow-y: auto;
       scroll-behavior: smooth;
   }
   
   /* ============================================================================
      Welcome Screen
      ============================================================================ */
   
   .welcome {
       display: flex;
       flex-direction: column;
       align-items: center;
       justify-content: center;
       height: 100%;
       padding: 40px 24px;
       text-align: center;
       animation: welcomeFade 0.6s ease;
   }
   
   @keyframes welcomeFade {
       from { opacity: 0; transform: translateY(16px); }
       to { opacity: 1; transform: translateY(0); }
   }
   
   .welcome h1 {
       font-size: 32px;
       font-weight: 700;
       color: var(--text-primary);
       margin-bottom: 12px;
       letter-spacing: -0.5px;
       line-height: 1.2;
   }
   
   .welcome p {
       font-size: 15px;
       color: var(--text-secondary);
       max-width: 480px;
       line-height: 1.6;
       margin-bottom: 40px;
   }
   
   .suggestions {
       display: grid;
       grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
       gap: 12px;
       max-width: 640px;
       width: 100%;
   }
   
   .suggestion-card {
       padding: 16px;
       background: var(--bg-secondary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-md);
       cursor: pointer;
       text-align: left;
       transition: all var(--transition-fast);
   }
   
   .suggestion-card:hover {
       background: var(--bg-hover);
       border-color: var(--accent-primary);
       transform: translateY(-2px);
       box-shadow: var(--shadow-md);
   }
   
   .suggestion-title {
       font-size: 14px;
       font-weight: 600;
       color: var(--text-primary);
       margin-bottom: 4px;
   }
   
   .suggestion-text {
       font-size: 12.5px;
       color: var(--text-tertiary);
   }
   
   /* ============================================================================
      Messages
      ============================================================================ */
   
   .message {
       padding: 24px 0;
       animation: messageIn 0.35s ease;
   }
   
   @keyframes messageIn {
       from { opacity: 0; transform: translateY(8px); }
       to { opacity: 1; transform: translateY(0); }
   }
   
   .message.user {
       background: transparent;
   }
   
   .message.assistant {
       background: var(--bg-secondary);
       border-top: 1px solid var(--border-secondary);
       border-bottom: 1px solid var(--border-secondary);
   }
   
   .light-mode .message.assistant {
       background: var(--bg-tertiary);
   }
   
   .message-header {
       display: flex;
       align-items: center;
       gap: 12px;
       margin-bottom: 8px;
       max-width: var(--chat-max-width);
       margin-left: auto;
       margin-right: auto;
       padding: 0 24px;
   }
   
   .avatar {
       width: 28px;
       height: 28px;
       border-radius: var(--radius-full);
       display: flex;
       align-items: center;
       justify-content: center;
       font-size: 14px;
       flex-shrink: 0;
   }
   
   .avatar.user {
       background: var(--accent-primary);
       color: white;
       font-size: 12px;
   }
   
   .avatar.assistant {
       background: linear-gradient(135deg, var(--accent-primary), #e07850);
       color: white;
       font-size: 13px;
   }
   
   .sender-name {
       font-size: 13.5px;
       font-weight: 600;
       color: var(--text-primary);
   }
   
   .message-content {
       max-width: var(--chat-max-width);
       margin: 0 auto;
       padding: 0 24px 0 64px;
       font-size: 15px;
       line-height: 1.75;
       color: var(--text-primary);
       white-space: pre-wrap;
       word-wrap: break-word;
   }
   
   .message.user .message-content {
       color: var(--text-secondary);
   }
   
   /* ============================================================================
      Message Actions
      ============================================================================ */
   
   .message-edit-actions {
       max-width: var(--chat-max-width);
       margin: 8px auto 0;
       padding: 0 24px 0 64px;
       display: flex;
       gap: 4px;
       opacity: 0;
       transition: opacity var(--transition-fast);
   }
   
   .message:hover .message-edit-actions {
       opacity: 1;
   }
   
   .edit-msg-btn,
   .delete-msg-btn {
       padding: 4px 8px;
       background: none;
       border: 1px solid var(--border-primary);
       border-radius: 6px;
       color: var(--text-tertiary);
       cursor: pointer;
       font-size: 12px;
       transition: all var(--transition-fast);
   }
   
   .edit-msg-btn:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
       border-color: var(--text-tertiary);
   }
   
   .delete-msg-btn:hover {
       background: rgba(239, 68, 68, 0.1);
       color: var(--danger);
       border-color: var(--danger);
   }
   
   .message-actions {
       max-width: var(--chat-max-width);
       margin: 12px auto 0;
       padding: 0 24px 0 64px;
   }
   
   .regenerate-btn {
       padding: 6px 12px;
       background: none;
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-tertiary);
       cursor: pointer;
       font-size: 12.5px;
       font-family: var(--font-primary);
       transition: all var(--transition-fast);
   }
   
   .regenerate-btn:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
       border-color: var(--text-tertiary);
   }
   
   .feedback-buttons {
       max-width: var(--chat-max-width);
       margin: 8px auto 0;
       padding: 0 24px 0 64px;
       display: flex;
       gap: 6px;
   }
   
   .feedback-btn {
       padding: 4px 10px;
       background: none;
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-full);
       color: var(--text-tertiary);
       cursor: pointer;
       font-size: 12px;
       font-family: var(--font-primary);
       transition: all var(--transition-fast);
   }
   
   .feedback-btn:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
   }
   
   .feedback-btn.active.thumbs-up {
       background: rgba(52, 199, 89, 0.12);
       color: var(--success);
       border-color: var(--success);
   }
   
   .feedback-btn.active.thumbs-down {
       background: rgba(239, 68, 68, 0.12);
       color: var(--danger);
       border-color: var(--danger);
   }
   
   /* ============================================================================
      Edit Message
      ============================================================================ */
   
   .edit-textarea {
       width: 100%;
       padding: 12px;
       background: var(--bg-input);
       border: 1px solid var(--border-focus);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 14px;
       font-family: var(--font-primary);
       line-height: 1.6;
       resize: vertical;
       outline: none;
       box-shadow: var(--shadow-glow);
   }
   
   .edit-actions {
       display: flex;
       gap: 8px;
       margin-top: 8px;
   }
   
   .edit-save-btn,
   .edit-cancel-btn {
       padding: 6px 14px;
       border-radius: var(--radius-sm);
       font-size: 12.5px;
       font-family: var(--font-primary);
       font-weight: 500;
       cursor: pointer;
       transition: all var(--transition-fast);
       border: none;
   }
   
   .edit-save-btn {
       background: var(--accent-primary);
       color: white;
   }
   
   .edit-save-btn:hover {
       background: var(--accent-hover);
   }
   
   .edit-cancel-btn {
       background: var(--bg-tertiary);
       color: var(--text-secondary);
       border: 1px solid var(--border-primary);
   }
   
   .edit-cancel-btn:hover {
       background: var(--bg-hover);
   }
   
   /* ============================================================================
      Typing Indicator
      ============================================================================ */
   
   .typing-indicator {
       max-width: var(--chat-max-width);
       margin: 0 auto;
       padding: 0 24px 0 64px;
       display: flex;
       gap: 5px;
       align-items: center;
       height: 24px;
   }
   
   .typing-dot {
       width: 7px;
       height: 7px;
       border-radius: 50%;
       background: var(--text-tertiary);
       animation: typingPulse 1.4s ease-in-out infinite;
   }
   
   .typing-dot:nth-child(2) { animation-delay: 0.2s; }
   .typing-dot:nth-child(3) { animation-delay: 0.4s; }
   
   @keyframes typingPulse {
       0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
       30% { opacity: 1; transform: scale(1); }
   }
   
   .streaming-cursor {
       display: inline-block;
       width: 2px;
       height: 18px;
       background: var(--accent-primary);
       margin-left: 2px;
       vertical-align: text-bottom;
       animation: cursorBlink 0.8s ease infinite;
   }
   
   @keyframes cursorBlink {
       0%, 100% { opacity: 1; }
       50% { opacity: 0; }
   }
   
   /* ============================================================================
      Input Area
      ============================================================================ */
   
   .input-area {
       flex-shrink: 0;
       padding: 16px 24px 24px;
       background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
   }
   
   .input-wrapper {
       max-width: var(--chat-max-width);
       margin: 0 auto;
   }
   
   .attached-files-container {
       display: none;
       margin-bottom: 8px;
   }
   
   .attached-files {
       display: flex;
       flex-wrap: wrap;
       gap: 8px;
   }
   
   .attached-file {
       display: flex;
       align-items: center;
       gap: 6px;
       padding: 6px 10px;
       background: var(--bg-tertiary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       font-size: 12px;
       color: var(--text-primary);
   }
   
   .remove-file,
   .file-remove {
       background: none;
       border: none;
       color: var(--text-tertiary);
       cursor: pointer;
       font-size: 16px;
       line-height: 1;
       padding: 0 2px;
       transition: color var(--transition-fast);
   }
   
   .remove-file:hover,
   .file-remove:hover {
       color: var(--danger);
   }
   
   .input-container {
       display: flex;
       align-items: flex-end;
       gap: 8px;
       padding: 8px;
       background: var(--bg-secondary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-lg);
       transition: all var(--transition-fast);
       box-shadow: var(--shadow-sm);
   }
   
   .input-container:focus-within {
       border-color: var(--border-focus);
       box-shadow: var(--shadow-glow), var(--shadow-md);
   }
   
   .attach-button {
       width: 36px;
       height: 36px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: none;
       border: none;
       color: var(--text-tertiary);
       cursor: pointer;
       border-radius: var(--radius-sm);
       font-size: 18px;
       transition: all var(--transition-fast);
       flex-shrink: 0;
   }
   
   .attach-button:hover {
       color: var(--text-primary);
       background: var(--bg-hover);
   }
   
   .message-input {
       flex: 1;
       border: none;
       background: transparent;
       color: var(--text-primary);
       font-size: 15px;
       font-family: var(--font-primary);
       line-height: 1.5;
       resize: none;
       outline: none;
       min-height: 24px;
       max-height: 200px;
       padding: 6px 0;
   }
   
   .message-input::placeholder {
       color: var(--text-tertiary);
   }
   
   .send-button {
       width: 36px;
       height: 36px;
       display: flex;
       align-items: center;
       justify-content: center;
       background: var(--accent-primary);
       border: none;
       border-radius: var(--radius-sm);
       cursor: pointer;
       transition: all var(--transition-fast);
       flex-shrink: 0;
   }
   
   .send-button:hover {
       background: var(--accent-hover);
       transform: scale(1.05);
   }
   
   .send-button:active {
       transform: scale(0.95);
   }
   
   .send-button:disabled {
       opacity: 0.5;
       cursor: not-allowed;
       transform: none;
   }
   
   .send-button svg {
       width: 18px;
       height: 18px;
       color: white;
   }
   
   /* ============================================================================
      Code Blocks & Execution
      ============================================================================ */
   
   .message-content pre {
       background: var(--bg-primary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       padding: 36px 16px 16px;
       margin: 12px 0;
       overflow-x: auto;
       font-size: 13px;
       line-height: 1.6;
       position: relative;
   }
   
   .message-content pre::-webkit-scrollbar {
       height: 4px;
   }
   
   .message-content pre::-webkit-scrollbar-track {
       background: transparent;
   }
   
   .message-content pre::-webkit-scrollbar-thumb {
       background: var(--border-primary);
       border-radius: 4px;
   }
   
   .message-content code {
       font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
       font-size: 13px;
   }
   
   .message-content pre code {
       background: none;
       padding: 0;
   }
   
   .message-content p code {
       background: var(--bg-tertiary);
       padding: 2px 6px;
       border-radius: 4px;
       font-size: 13px;
   }
   
   .run-code-btn {
       position: absolute;
       top: 8px;
       right: 8px;
       padding: 4px 10px;
       background: var(--accent-primary);
       color: white;
       border: none;
       border-radius: 6px;
       font-size: 11px;
       font-family: var(--font-primary);
       font-weight: 600;
       cursor: pointer;
       transition: all var(--transition-fast);
       z-index: 2;
   }
   
   .run-code-btn:hover {
       background: var(--accent-hover);
   }
   
   .run-code-btn:disabled {
       opacity: 0.6;
       cursor: wait;
   }
   
   .copy-code-btn {
       position: absolute;
       top: 8px;
       right: 80px;
       padding: 4px 10px;
       background: var(--bg-tertiary);
       color: var(--text-secondary);
       border: 1px solid var(--border-primary);
       border-radius: 6px;
       font-size: 11px;
       font-family: var(--font-primary);
       font-weight: 600;
       cursor: pointer;
       transition: all var(--transition-fast);
       z-index: 2;
   }
   
   .copy-code-btn:hover {
       background: var(--bg-hover);
       color: var(--text-primary);
       border-color: var(--text-tertiary);
   }
   
   .code-result {
       border-radius: var(--radius-md);
       margin: 12px 0;
       overflow: hidden;
       border: 1px solid var(--border-primary);
       background: var(--bg-secondary);
   }
   
   .code-result.success {
       border-color: rgba(52, 199, 89, 0.25);
       background: rgba(52, 199, 89, 0.03);
   }
   
   .code-result.error {
       border-color: rgba(239, 68, 68, 0.25);
       background: rgba(239, 68, 68, 0.03);
   }
   
   .code-result-header {
       display: flex;
       justify-content: space-between;
       align-items: center;
       padding: 10px 16px;
       background: var(--bg-tertiary);
       border-bottom: 1px solid var(--border-secondary);
       font-size: 12.5px;
   }
   
   .code-result.success .code-result-header {
       background: rgba(52, 199, 89, 0.06);
       border-bottom-color: rgba(52, 199, 89, 0.15);
   }
   
   .code-result.error .code-result-header {
       background: rgba(239, 68, 68, 0.06);
       border-bottom-color: rgba(239, 68, 68, 0.15);
   }
   
   .code-result-status {
       font-weight: 700;
       font-size: 13px;
   }
   
   .code-result.success .code-result-status {
       color: var(--success);
   }
   
   .code-result.error .code-result-status {
       color: var(--danger);
   }
   
   .code-result-time {
       color: var(--text-tertiary);
       font-size: 12px;
       display: flex;
       align-items: center;
       gap: 4px;
   }
   
   .code-result-section {
       padding: 14px 16px;
       border-top: 1px solid var(--border-secondary);
   }
   
   .code-result-section:first-of-type {
       border-top: none;
   }
   
   .code-result-label {
       font-size: 10.5px;
       font-weight: 700;
       color: var(--text-tertiary);
       text-transform: uppercase;
       letter-spacing: 1px;
       margin-bottom: 8px;
   }
   
   .code-result-output {
       font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
       font-size: 13px;
       line-height: 1.6;
       color: var(--text-primary);
       white-space: pre-wrap;
       margin: 0;
       background: var(--bg-primary);
       padding: 10px 12px;
       border-radius: var(--radius-sm);
       border: 1px solid var(--border-secondary);
   }
   
   .code-result-output.empty {
       color: var(--text-tertiary);
       font-style: italic;
       font-family: var(--font-primary);
       background: transparent;
       border: none;
       padding: 4px 0;
   }
   
   .code-result-error {
       font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
       font-size: 13px;
       line-height: 1.6;
       color: var(--danger);
       white-space: pre-wrap;
       margin: 0;
       background: rgba(239, 68, 68, 0.05);
       padding: 10px 12px;
       border-radius: var(--radius-sm);
       border: 1px solid rgba(239, 68, 68, 0.15);
   }
   
   /* ============================================================================
      Markdown Body Styles
      ============================================================================ */
   
   .markdown-body {
       white-space: normal !important;
   }
   
   .markdown-body h1,
   .markdown-body h2,
   .markdown-body h3,
   .markdown-body h4 {
       color: var(--text-primary);
       font-weight: 700;
       margin: 16px 0 8px;
       letter-spacing: -0.3px;
       line-height: 1.3;
   }
   
   .markdown-body h1 { font-size: 20px; }
   .markdown-body h2 { font-size: 18px; }
   .markdown-body h3 { font-size: 16px; }
   
   .markdown-body p {
       margin: 8px 0;
       line-height: 1.75;
   }
   
   .markdown-body ul,
   .markdown-body ol {
       margin: 8px 0;
       padding-left: 24px;
   }
   
   .markdown-body li {
       margin: 4px 0;
       line-height: 1.6;
   }
   
   .markdown-body strong {
       font-weight: 700;
       color: var(--text-primary);
   }
   
   .markdown-body em {
       font-style: italic;
       color: var(--text-secondary);
   }
   
   .markdown-body blockquote {
       border-left: 3px solid var(--accent-primary);
       padding: 4px 16px;
       margin: 12px 0;
       color: var(--text-secondary);
       background: var(--accent-subtle);
       border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
   }
   
   .markdown-body hr {
       border: none;
       border-top: 1px solid var(--border-primary);
       margin: 16px 0;
   }
   
   .markdown-body table {
       border-collapse: collapse;
       width: 100%;
       margin: 12px 0;
       font-size: 14px;
   }
   
   .markdown-body th,
   .markdown-body td {
       border: 1px solid var(--border-primary);
       padding: 8px 12px;
       text-align: left;
   }
   
   .markdown-body th {
       background: var(--bg-tertiary);
       font-weight: 600;
       color: var(--text-primary);
   }
   
   .markdown-body td {
       color: var(--text-secondary);
   }
   
   /* ============================================================================
      Export Menu
      ============================================================================ */
   
   .export-menu {
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       box-shadow: var(--shadow-lg);
       overflow: hidden;
       min-width: 180px;
       z-index: 1000;
   }
   
   .export-menu-item {
       padding: 10px 14px;
       font-size: 13px;
       color: var(--text-primary);
       cursor: pointer;
       transition: background var(--transition-fast);
       font-family: var(--font-primary);
   }
   
   .export-menu-item:hover {
       background: var(--bg-hover);
   }
   
   /* ============================================================================
      Search Results
      ============================================================================ */
   
   .search-results-dropdown {
       position: absolute;
       top: 100%;
       left: 0;
       right: 0;
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       box-shadow: var(--shadow-lg);
       max-height: 300px;
       overflow-y: auto;
       z-index: 500;
       margin-top: 4px;
   }
   
   .search-result-item {
       padding: 12px 14px;
       cursor: pointer;
       border-bottom: 1px solid var(--border-secondary);
       transition: background var(--transition-fast);
   }
   
   .search-result-item:hover {
       background: var(--bg-hover);
   }
   
   .search-result-item:last-child {
       border-bottom: none;
   }
   
   .search-result-title {
       font-size: 13px;
       font-weight: 600;
       color: var(--text-primary);
       margin-bottom: 4px;
   }
   
   .search-result-preview {
       font-size: 12px;
       color: var(--text-secondary);
       display: -webkit-box;
       -webkit-line-clamp: 2;
       -webkit-box-orient: vertical;
       line-clamp: 2;
       box-orient: vertical;
       overflow: hidden;
   }
   
   .search-result-meta {
       font-size: 11px;
       color: var(--text-tertiary);
       margin-top: 4px;
   }
   
   mark {
       background: rgba(124, 108, 240, 0.25);
       color: var(--accent-text);
       border-radius: 2px;
       padding: 0 2px;
   }
   
   /* ============================================================================
      Keyboard Shortcuts Modal
      ============================================================================ */
   
   .modal-overlay {
       position: fixed;
       inset: 0;
       background: rgba(0, 0, 0, 0.6);
       display: flex;
       align-items: center;
       justify-content: center;
       z-index: 1000;
       backdrop-filter: blur(6px);
       animation: modalFade 0.2s ease;
   }
   
   @keyframes modalFade {
       from { opacity: 0; }
       to { opacity: 1; }
   }
   
   .shortcuts-content {
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-lg);
       padding: 28px;
       max-width: 420px;
       width: 90%;
       box-shadow: var(--shadow-lg);
   }
   
   .shortcuts-content h3 {
       font-size: 17px;
       font-weight: 700;
       color: var(--text-primary);
       margin-bottom: 20px;
       letter-spacing: -0.3px;
   }
   
   .shortcut-row {
       display: flex;
       justify-content: space-between;
       align-items: center;
       padding: 8px 0;
       font-size: 13.5px;
       color: var(--text-secondary);
       border-bottom: 1px solid var(--border-secondary);
   }
   
   .shortcut-row:last-of-type {
       border-bottom: none;
   }
   
   .shortcut-keys {
       display: flex;
       gap: 4px;
   }
   
   .shortcut-keys kbd {
       padding: 3px 8px;
       background: var(--bg-primary);
       border: 1px solid var(--border-primary);
       border-radius: 5px;
       font-size: 11.5px;
       font-family: var(--font-primary);
       font-weight: 600;
       color: var(--text-primary);
   }
   
   .shortcuts-close-btn {
       width: 100%;
       padding: 10px;
       background: var(--bg-tertiary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 13px;
       font-family: var(--font-primary);
       font-weight: 500;
       cursor: pointer;
       margin-top: 20px;
       transition: all var(--transition-fast);
   }
   
   .shortcuts-close-btn:hover {
       background: var(--bg-hover);
   }
   
   /* ============================================================================
      User Menu
      ============================================================================ */
   
   .user-menu {
       position: relative;
   }
   
   .user-avatar-btn {
       width: 34px;
       height: 34px;
       border-radius: var(--radius-full);
       background: var(--accent-primary);
       border: none;
       cursor: pointer;
       display: flex;
       align-items: center;
       justify-content: center;
       transition: all var(--transition-fast);
   }
   
   .user-avatar-btn:hover {
       transform: scale(1.05);
       box-shadow: var(--shadow-glow);
   }
   
   .user-avatar-text {
       color: white;
       font-size: 14px;
       font-weight: 600;
       font-family: var(--font-primary);
   }
   
   .user-dropdown {
       position: absolute;
       top: calc(100% + 8px);
       right: 0;
       min-width: 220px;
       background: var(--bg-elevated);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-md);
       box-shadow: var(--shadow-lg);
       opacity: 0;
       visibility: hidden;
       transform: translateY(-4px) scale(0.98);
       transition: all var(--transition-fast);
       z-index: 1000;
       overflow: hidden;
   }
   
   .user-dropdown.show {
       opacity: 1;
       visibility: visible;
       transform: translateY(0) scale(1);
   }
   
   .user-dropdown-header {
       padding: 14px 16px;
       display: flex;
       flex-direction: column;
       gap: 2px;
   }
   
   .dropdown-name {
       font-size: 14px;
       font-weight: 600;
       color: var(--text-primary);
   }
   
   .dropdown-email {
       font-size: 12px;
       color: var(--text-tertiary);
   }
   
   .user-dropdown-divider {
       height: 1px;
       background: var(--border-secondary);
   }
   
   .user-dropdown-item {
       display: block;
       width: 100%;
       padding: 10px 16px;
       font-size: 13.5px;
       color: var(--text-secondary);
       background: none;
       border: none;
       text-align: left;
       cursor: pointer;
       text-decoration: none;
       font-family: var(--font-primary);
       transition: background var(--transition-fast);
   }
   
   .user-dropdown-item:hover {
       background: var(--bg-hover);
   }
   
   .logout-item:hover {
       color: var(--danger);
       background: rgba(239, 68, 68, 0.08);
   }
   
   /* ============================================================================
      Auth Pages
      ============================================================================ */
   
   .auth-page {
       min-height: 100vh;
       display: flex;
       align-items: center;
       justify-content: center;
       background: var(--bg-primary);
       padding: 24px;
   }
   
   .auth-card {
       width: 100%;
       max-width: 400px;
       background: var(--bg-secondary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-lg);
       padding: 40px 32px;
       box-shadow: var(--shadow-lg);
   }
   
   .auth-logo {
       text-align: center;
       margin-bottom: 32px;
   }
   
   .auth-logo h1 {
       font-size: 24px;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.5px;
   }
   
   .auth-logo p {
       font-size: 14px;
       color: var(--text-tertiary);
       margin-top: 6px;
   }
   
   .auth-form {
       display: flex;
       flex-direction: column;
       gap: 16px;
   }
   
   .form-group {
       display: flex;
       flex-direction: column;
       gap: 6px;
   }
   
   .form-group label {
       font-size: 13px;
       font-weight: 500;
       color: var(--text-secondary);
   }
   
   .form-group input {
       padding: 10px 14px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 14px;
       font-family: var(--font-primary);
       outline: none;
       transition: all var(--transition-fast);
   }
   
   .form-group input:focus {
       border-color: var(--border-focus);
       box-shadow: var(--shadow-glow);
   }
   
   .form-group input::placeholder {
       color: var(--text-tertiary);
   }
   
   .auth-submit {
       padding: 12px;
       background: var(--accent-primary);
       color: white;
       border: none;
       border-radius: var(--radius-sm);
       font-size: 14px;
       font-weight: 600;
       font-family: var(--font-primary);
       cursor: pointer;
       transition: all var(--transition-fast);
       margin-top: 4px;
   }
   
   .auth-submit:hover {
       background: var(--accent-hover);
       transform: translateY(-1px);
       box-shadow: var(--shadow-md);
   }
   
   .auth-submit:disabled {
       opacity: 0.6;
       cursor: not-allowed;
       transform: none;
   }
   
   .auth-footer {
       text-align: center;
       margin-top: 20px;
       font-size: 13px;
       color: var(--text-tertiary);
   }
   
   .auth-footer a {
       color: var(--accent-text);
       text-decoration: none;
       font-weight: 500;
   }
   
   .auth-footer a:hover {
       text-decoration: underline;
   }
   
   .auth-divider {
       display: flex;
       align-items: center;
       gap: 12px;
       color: var(--text-tertiary);
       font-size: 12px;
   }
   
   .auth-divider::before,
   .auth-divider::after {
       content: '';
       flex: 1;
       height: 1px;
       background: var(--border-primary);
   }
   
   .google-btn {
       width: 100%;
       padding: 10px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 13.5px;
       font-family: var(--font-primary);
       font-weight: 500;
       cursor: pointer;
       display: flex;
       align-items: center;
       justify-content: center;
       gap: 8px;
       transition: all var(--transition-fast);
   }
   
   .google-btn:hover {
       background: var(--bg-hover);
       border-color: var(--text-tertiary);
   }
   
   .auth-error {
       padding: 10px 14px;
       background: rgba(239, 68, 68, 0.1);
       border: 1px solid rgba(239, 68, 68, 0.2);
       border-radius: var(--radius-sm);
       color: var(--danger);
       font-size: 13px;
       display: none;
   }
   
   /* ============================================================================
      Profile Page
      ============================================================================ */
   
   .profile-container {
       max-width: 600px;
       margin: 0 auto;
       padding: 40px 24px;
   }
   
   .profile-header {
       margin-bottom: 32px;
   }
   
   .profile-header h2 {
       font-size: 22px;
       font-weight: 700;
       color: var(--text-primary);
       letter-spacing: -0.3px;
   }
   
   .profile-section {
       background: var(--bg-secondary);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-md);
       padding: 24px;
       margin-bottom: 16px;
   }
   
   .profile-section h3 {
       font-size: 15px;
       font-weight: 600;
       color: var(--text-primary);
       margin-bottom: 16px;
   }
   
   .profile-field {
       display: flex;
       flex-direction: column;
       gap: 6px;
       margin-bottom: 16px;
   }
   
   .profile-field:last-child {
       margin-bottom: 0;
   }
   
   .profile-field label {
       font-size: 12.5px;
       font-weight: 500;
       color: var(--text-tertiary);
       text-transform: uppercase;
       letter-spacing: 0.5px;
   }
   
   .profile-field input,
   .profile-field select {
       padding: 10px 14px;
       background: var(--bg-input);
       border: 1px solid var(--border-primary);
       border-radius: var(--radius-sm);
       color: var(--text-primary);
       font-size: 14px;
       font-family: var(--font-primary);
       outline: none;
       transition: all var(--transition-fast);
   }
   
   .profile-field input:focus,
   .profile-field select:focus {
       border-color: var(--border-focus);
       box-shadow: var(--shadow-glow);
   }
   
   .profile-save-btn {
       padding: 10px 20px;
       background: var(--accent-primary);
       color: white;
       border: none;
       border-radius: var(--radius-sm);
       font-size: 13.5px;
       font-weight: 600;
       font-family: var(--font-primary);
       cursor: pointer;
       transition: all var(--transition-fast);
   }
   
   .profile-save-btn:hover {
       background: var(--accent-hover);
   }
   
   .profile-back-link {
       display: inline-flex;
       align-items: center;
       gap: 6px;
       color: var(--text-tertiary);
       text-decoration: none;
       font-size: 13px;
       margin-bottom: 20px;
       transition: color var(--transition-fast);
   }
   
   .profile-back-link:hover {
       color: var(--text-primary);
   }
   
   /* ============================================================================
      Responsive — Mobile
      ============================================================================ */
   
   @media (max-width: 768px) {
       .sidebar {
           position: fixed;
           top: var(--header-height);
           left: 0;
           bottom: 0;
           z-index: 50;
           transform: translateX(-100%);
           box-shadow: var(--shadow-lg);
       }
   
       .sidebar.open {
           transform: translateX(0);
       }
   
       .files-panel {
           position: fixed;
           top: var(--header-height);
           right: 0;
           bottom: 0;
           z-index: 50;
           box-shadow: var(--shadow-lg);
       }
   
       .welcome h1 {
           font-size: 24px;
       }
   
       .suggestions {
           grid-template-columns: 1fr;
       }
   
       .message-content {
           padding: 0 16px 0 48px;
       }
   
       .message-header {
           padding: 0 16px;
       }
   
       .message-edit-actions,
       .message-actions,
       .feedback-buttons,
       .typing-indicator {
           padding-left: 48px;
           padding-right: 16px;
       }
   
       .input-area {
           padding: 12px 12px 16px;
       }
   }
   
   @media (max-width: 480px) {
       .header {
           padding: 0 10px;
       }
   
       .new-chat-btn {
           padding: 7px 12px;
           font-size: 12px;
       }
   
       .message-content {
           font-size: 14px;
           padding: 0 12px 0 40px;
       }
   
       .message-header {
           padding: 0 12px;
       }
   
       .welcome h1 {
           font-size: 20px;
       }
   
       .welcome p {
           font-size: 14px;
       }
   
       .auth-card {
           padding: 28px 20px;
       }
   }
   
   /* ============================================================================
      Task #16 — Loading States + Error Handling + Retry
      ============================================================================ */
   
   /* Loading state with status text */
   .loading-state {
       display: flex;
       align-items: center;
       gap: 12px;
       padding: 0 24px 0 64px;
       max-width: var(--chat-max-width);
       margin: 0 auto;
   }
   
   .loading-dots {
       display: flex;
       gap: 5px;
       align-items: center;
   }
   
   .loading-status {
       font-size: 13px;
       color: var(--text-tertiary);
       font-style: italic;
       animation: statusFade 0.3s ease;
   }
   
   @keyframes statusFade {
       from { opacity: 0; transform: translateY(2px); }
       to { opacity: 1; transform: translateY(0); }
   }
   
   /* Error message */
   .error-message .avatar.error-avatar {
       background: linear-gradient(135deg, var(--danger), #c0392b);
   }
   
   .error-content {
       max-width: var(--chat-max-width);
       margin: 0 auto;
       padding: 0 24px 0 64px;
       display: flex;
       flex-direction: column;
       gap: 10px;
   }
   
   .error-icon {
       font-size: 16px;
   }
   
   .error-text {
       font-size: 14px;
       color: var(--danger);
       background: rgba(239, 68, 68, 0.08);
       border: 1px solid rgba(239, 68, 68, 0.2);
       border-radius: var(--radius-sm);
       padding: 10px 14px;
       line-height: 1.5;
   }
   
   /* Inline retry button */
   .error-actions {
       display: flex;
       gap: 8px;
   }
   
   .retry-btn-inline {
       padding: 5px 12px;
       background: rgba(239, 68, 68, 0.1);
       color: var(--danger);
       border: 1px solid rgba(239, 68, 68, 0.3);
       border-radius: var(--radius-sm);
       font-size: 12.5px;
       font-family: var(--font-primary);
       font-weight: 600;
       cursor: pointer;
       transition: all var(--transition-fast);
   }
   
   .retry-btn-inline:hover {
       background: rgba(239, 68, 68, 0.18);
       border-color: var(--danger);
   }
   
   /* Below retry button */
   .retry-below {
       margin-top: 4px;
   }
   
   .retry-btn-below {
       padding: 8px 18px;
       background: var(--accent-primary);
       color: white;
       border: none;
       border-radius: var(--radius-sm);
       font-size: 13px;
       font-family: var(--font-primary);
       font-weight: 600;
       cursor: pointer;
       transition: all var(--transition-fast);
   }
   
   .retry-btn-below:hover {
       background: var(--accent-hover);
       transform: translateY(-1px);
       box-shadow: var(--shadow-md);
   }
   
   .retry-btn-below:active {
       transform: translateY(0);
   }
   
   @media (max-width: 768px) {
       .loading-state,
       .error-content {
           padding-left: 48px;
           padding-right: 16px;
       }
   }

/* ============================================================================
   Task #17 — Memory Indicator
   ============================================================================ */

   .memory-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: var(--accent-subtle);
    border: 1px solid rgba(124, 108, 240, 0.2);
    border-radius: var(--radius-full);
    width: fit-content;
    font-size: 12px;
    color: var(--accent-text);
    font-weight: 500;
    animation: memoryFadeIn 0.3s ease;
}

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

.memory-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    flex-shrink: 0;
    animation: memoryPulse 2s ease-in-out infinite;
}

@keyframes memoryPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.memory-text {
    font-size: 12px;
    color: var(--accent-text);
}

/* ============================================================================
   Task #17 — Memory Indicator
   ============================================================================ */

   .memory-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: var(--accent-subtle);
    border: 1px solid rgba(124, 108, 240, 0.2);
    border-radius: var(--radius-full);
    width: fit-content;
    font-size: 12px;
    color: var(--accent-text);
    font-weight: 500;
    animation: memoryFadeIn 0.3s ease;
}

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

.memory-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    flex-shrink: 0;
    animation: memoryPulse 2s ease-in-out infinite;
}

@keyframes memoryPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.memory-text {
    font-size: 12px;
    color: var(--accent-text);
}

/* ============================================================================
   Task #16 — Loading States + Error Handling + Retry
   ============================================================================ */

.loading-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 0 64px;
    max-width: var(--chat-max-width);
    margin: 0 auto;
}

.loading-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.loading-status {
    font-size: 13px;
    color: var(--text-tertiary);
    font-style: italic;
    animation: statusFade 0.3s ease;
}

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

.error-message .avatar.error-avatar {
    background: linear-gradient(135deg, var(--danger), #c0392b);
}

.error-content {
    max-width: var(--chat-max-width);
    margin: 0 auto;
    padding: 0 24px 0 64px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.error-icon {
    font-size: 16px;
}

.error-text {
    font-size: 14px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: 8px;
}

.retry-btn-inline {
    padding: 5px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-family: var(--font-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.retry-btn-inline:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: var(--danger);
}

.retry-below {
    margin-top: 4px;
}

.retry-btn-below {
    padding: 8px 18px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.retry-btn-below:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.retry-btn-below:active {
    transform: translateY(0);
}

/* ============================================================================
   Task #20 — User Avatar with Initials
   ============================================================================ */

.user-avatar-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), #e07850);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(124, 108, 240, 0.3);
}

.user-avatar-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(124, 108, 240, 0.4);
}

.user-avatar-text {
    color: white;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-primary);
    letter-spacing: 0.3px;
}

/* Dropdown header with avatar */
.user-dropdown-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), #e07850);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    font-family: var(--font-primary);
    flex-shrink: 0;
}

.dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-email {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   Task #18 — Mobile Responsive Fixes
   ============================================================================ */

/* Better touch targets on mobile */
@media (max-width: 768px) {

    /* Header */
    .header {
        padding: 0 12px;
    }

    .new-chat-btn {
        display: none; /* Hidden on mobile — use sidebar instead */
    }

    /* Loading + error states */
    .loading-state,
    .error-content {
        padding-left: 48px;
        padding-right: 16px;
    }

    /* Memory indicator */
    .memory-indicator {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Input area */
    .input-area {
        padding: 8px 12px 16px;
    }

    .input-container {
        padding: 6px 8px;
        border-radius: var(--radius-md);
    }

    .message-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .attach-button,
    .send-button {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

    /* Messages */
    .message {
        padding: 16px 0;
    }

    .message-content {
        padding: 0 12px 0 48px;
        font-size: 14.5px;
    }

    .message-header {
        padding: 0 12px;
    }

    .message-edit-actions,
    .message-actions,
    .feedback-buttons,
    .typing-indicator {
        padding-left: 48px;
        padding-right: 12px;
    }

    /* Code blocks on mobile */
    .message-content pre {
        font-size: 12px;
        padding: 36px 10px 10px;
    }

    .run-code-btn {
        font-size: 10px;
        padding: 3px 8px;
    }

    .copy-code-btn {
        right: 70px;
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Welcome screen */
    .welcome {
        padding: 24px 16px;
    }

    .welcome h1 {
        font-size: 22px;
    }

    .welcome p {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .suggestions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .suggestion-card {
        padding: 12px;
    }

    .suggestion-title {
        font-size: 13px;
    }

    .suggestion-text {
        font-size: 11.5px;
    }

    /* Sidebar full width on mobile */
    .sidebar {
        width: 85vw;
        max-width: 320px;
    }

    /* User dropdown on mobile */
    .user-dropdown {
        right: -8px;
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 10px;
    }

    .message-content {
        font-size: 14px;
        padding: 0 10px 0 44px;
    }

    .message-header {
        padding: 0 10px;
    }

    .welcome h1 {
        font-size: 20px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    /* Feedback buttons on small screens */
    .feedback-btn {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Files toggle hidden on very small screens */
    .files-toggle {
        display: none;
    }
}

/* Fix iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}