:root {
  --bg: #faf9f8;
  --surface: #ffffff;
  --surface-hover: #f3f2f1;
  --border: rgba(0, 0, 0, 0.06);
  --text: #111111;
  --text-muted: #6b6b6b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.06);
  --font-sans: 'Inter', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* MODALS */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--surface); width: 90%; max-width: 400px;
  border-radius: 20px; padding: 2rem; box-shadow: var(--shadow-lg);
  transform: translateY(20px); transition: var(--transition);
  border: 1px solid var(--border);
}
.modal-overlay.active .modal-card { transform: translateY(0); }

.auth-logo { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; text-align: center; }
.auth-logo span { color: var(--primary); }
.auth-tagline { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }
.auth-tabs { display: flex; background: var(--surface-hover); border-radius: var(--radius); padding: 4px; margin-bottom: 1.5rem; }
.auth-tab { flex: 1; padding: 8px; border-radius: var(--radius-sm); font-weight: 500; color: var(--text-muted); transition: var(--transition); }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.active { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.form-field input, .search-input {
  width: 100%; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 1rem; transition: var(--transition); outline: none;
}
.form-field input:focus, .search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(66, 103, 255, 0.1); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #3b82f6); color: white; padding: 12px 20px;
  border-radius: var(--radius); font-weight: 500; font-size: 1rem;
  transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); }
.w-full { width: 100%; }
.auth-msg { text-align: center; font-size: 0.85rem; padding: 8px; border-radius: var(--radius-sm); }
.auth-msg.error { background: #fee2e2; color: #b91c1c; }
.auth-msg.success { background: #dcfce3; color: #15803d; }

.onboard-title { font-size: 1.5rem; font-weight: 600; text-align: center; margin-bottom: 0.25rem; }
.onboard-sub { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1.5rem; }
.source-btn {
  display: flex; align-items: center; gap: 8px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 0.95rem; transition: var(--transition);
}
.source-btn svg { width: 20px; height: 20px; }
.source-btn:hover { background: var(--surface-hover); border-color: #ccc; }
.source-btn.selected { border-color: var(--primary); background: rgba(66, 103, 255, 0.05); }

/* APP LAYOUT */
.app { display: flex; height: 100vh; width: 100vw; }
.hidden { display: none !important; }

/* SIDEBAR */
.sidebar {
  width: 260px; height: 100%; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: var(--transition); z-index: 50; flex-shrink: 0;
}
.sidebar.collapsed { width: 0; overflow: hidden; border-right: none; }
.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.25rem; }
.sidebar-logo span { letter-spacing: -0.5px; }
.sidebar-logo em { color: var(--primary); font-style: normal; }
.sidebar-collapse-btn { padding: 4px; border-radius: 6px; color: var(--text-muted); transition: var(--transition); }
.sidebar-collapse-btn:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-collapse-btn svg { width: 20px; height: 20px; }

.new-chat-btn {
  margin: 0 16px 16px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.new-chat-btn svg { width: 16px; height: 16px; }
.new-chat-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-muted); font-size: 0.95rem; transition: var(--transition); font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: rgba(66, 103, 255, 0.1); color: var(--primary); }

.sidebar-section-title { font-size: 0.75rem; font-weight: 600; color: #a1a1aa; text-transform: uppercase; padding: 20px 24px 8px; letter-spacing: 0.5px; }
.sidebar-chats { flex: 1; overflow-y: auto; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  padding: 8px 12px; border-radius: var(--radius); font-size: 0.9rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; transition: var(--transition);
}
.chat-item:hover { background: var(--surface-hover); color: var(--text); }
.chat-item.active { background: var(--surface-hover); color: var(--text); font-weight: 500; }

.sidebar-bottom { border-top: 1px solid var(--border); padding: 16px; }
.sidebar-bottom-links { margin-bottom: 16px; }
.sidebar-link { display: flex; align-items: center; gap: 8px; color: var(--text-muted); text-decoration: none; font-size: 0.9rem; padding: 6px 8px; border-radius: var(--radius-sm); transition: var(--transition); }
.sidebar-link:hover { background: var(--surface-hover); color: var(--text); }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #4267ff, #7c3aed); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem; }
.user-meta { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.user-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; font-weight: 500; }
.plan-badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 99px; width: fit-content; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-top: 2px; }
.plan-badge.free { background: #f1f5f9; color: #64748b; }
.plan-badge.premium { background: #fef08a; color: #854d0e; }
.icon-btn { padding: 8px; color: var(--text-muted); border-radius: var(--radius-sm); transition: var(--transition); }
.icon-btn:hover { background: #fee2e2; color: #ef4444; }
.icon-btn svg { width: 18px; height: 18px; }

/* MAIN CONTENT */
.main-content { flex: 1; position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.view { display: none; height: 100%; flex-direction: column; }
.view.active { display: flex; }

/* CHAT VIEW */
.chat-area { flex: 1; overflow-y: auto; padding: 40px 20px; scroll-behavior: smooth; display: flex; flex-direction: column; align-items: center; }

.welcome-screen { width: 100%; max-width: 800px; margin: auto; display: flex; flex-direction: column; align-items: center; padding-bottom: 100px; }
.welcome-avatars { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.welcome-av { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--bg); margin-left: -12px; box-shadow: var(--shadow); transition: var(--transition); object-fit: cover; background: var(--surface); }
.welcome-av:first-child { margin-left: 0; }
.welcome-av:hover { transform: translateY(-4px); z-index: 10; }
.welcome-title { font-size: 2.8rem; font-weight: 700; text-align: center; margin-bottom: 32px; letter-spacing: -1.2px; background: linear-gradient(135deg, var(--text), #6b6b6b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.welcome-input {
  width: 100%; margin-bottom: 32px;
}

.welcome-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 600px; }
.chip { padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.9rem; color: var(--text-muted); transition: var(--transition); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.chip:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--text); box-shadow: var(--shadow); }

.messages { width: 100%; max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; padding-bottom: 20px; }
.message { display: flex; gap: 16px; animation: fadeIn 0.3s ease; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.msg-content { flex: 1; overflow: hidden; }
.msg-author { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg-time { font-weight: 400; font-size: 0.75rem; opacity: 0.7; }
.msg-body { font-size: 1rem; line-height: 1.6; color: var(--text); }
.thinking-text { font-size: 0.9rem; color: var(--text-muted); font-style: italic; margin-left: 12px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.msg-body p { margin-bottom: 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body pre { background: #111827; color: #f8fafc; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 12px 0; font-family: var(--font-mono); font-size: 0.9rem; border: 1px solid rgba(255,255,255,0.1); }
.msg-body code { background: rgba(0,0,0,0.05); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }
.msg-body pre code { background: none; padding: 0; }
.msg-body ul, .msg-body ol { margin-left: 20px; margin-bottom: 12px; }

.attachment-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: rgba(66, 103, 255, 0.1); color: var(--primary); border-radius: 6px; font-size: 0.85rem; font-weight: 500; margin: 4px 8px 8px 0; border: 1px solid rgba(66, 103, 255, 0.2); }
.attachment-badge img { width: 16px; height: 16px; object-fit: cover; border-radius: 3px; }
.attachment-img-preview { max-width: 300px; max-height: 300px; border-radius: var(--radius); margin: 8px 0; box-shadow: var(--shadow); object-fit: contain; }

.message.user { flex-direction: row-reverse; }
.message.user .msg-content { display: flex; flex-direction: column; align-items: flex-end; }
.message.user .msg-body { background: var(--surface); padding: 12px 16px; border-radius: 16px 16px 4px 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.message.assistant .msg-body { padding-top: 4px; }

.zip-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 16px 0; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow); transition: var(--transition); max-width: 400px;
}
.zip-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.zip-info { display: flex; align-items: center; gap: 12px; }
.zip-icon { width: 40px; height: 40px; background: rgba(66, 103, 255, 0.1); color: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.zip-icon svg { width: 20px; height: 20px; }
.zip-details h4 { font-size: 1rem; margin: 0 0 4px; font-weight: 600; }
.zip-details p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.zip-btn {
  background: var(--primary); color: white; padding: 8px 16px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 500; text-decoration: none; transition: var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.zip-btn:hover { background: var(--primary-hover); }

/* INPUT BAR */
.input-bar { position: absolute; bottom: 0; left: 0; width: 100%; padding: 20px; background: linear-gradient(transparent, var(--bg) 30%); display: flex; justify-content: center; z-index: 20; }
.input-wrapper { width: 100%; max-width: 800px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); transition: var(--transition); }
.input-wrapper:focus-within { border-color: rgba(66, 103, 255, 0.5); box-shadow: 0 8px 30px rgba(66, 103, 255, 0.15); }
.input-inner { display: flex; align-items: flex-end; padding: 12px 16px; gap: 12px; }
.attach-btn { padding: 8px; color: var(--text-muted); border-radius: 8px; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.attach-btn svg { width: 20px; height: 20px; }
.attach-btn:hover { background: var(--surface-hover); color: var(--text); }
.attach-btn:hover { background: var(--surface-hover); color: var(--text); }
#chatInput, #welcomeChatInput {
  flex: 1; border: none; background: transparent; font-size: 1rem; resize: none;
  max-height: 200px; min-height: 24px; padding: 8px 0; outline: none; line-height: 1.5; color: var(--text);
}
#chatInput::placeholder, #welcomeChatInput::placeholder { color: #a1a1aa; }
.input-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }

/* DROPDOWNS */
.mode-selector, .agent-selector { position: relative; }
.mode-dropdown-btn, .agent-dropdown-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface-hover); font-size: 0.85rem; font-weight: 500; color: var(--text-muted); transition: var(--transition);
}
.mode-dropdown-btn:hover, .agent-dropdown-btn:hover { background: #e4e4e7; color: var(--text); }
.agent-dropdown-btn { padding: 6px; border-radius: 50%; }

.mode-dropdown, .agent-dropdown {
  position: absolute; bottom: calc(100% + 10px); right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 8px; display: none; flex-direction: column; gap: 4px; z-index: 100; min-width: 140px;
}
.agent-dropdown { min-width: 200px; max-height: 300px; overflow-y: auto; }
.mode-selector.open .mode-dropdown, .agent-selector.open .agent-dropdown { display: flex; animation: slideUp 0.2s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.mode-option, .agent-option {
  padding: 8px 12px; text-align: left; border-radius: 8px; font-size: 0.9rem;
  transition: var(--transition); display: flex; align-items: center; gap: 10px; color: var(--text);
}
.mode-option:hover, .agent-option:hover { background: var(--surface-hover); }
.mode-option.active, .agent-option.active { background: rgba(66, 103, 255, 0.1); color: var(--primary); font-weight: 500; }
.agent-option span { font-size: 20px; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: rgba(0,0,0,0.04); border-radius: 50%; }
.agent-option small { color: var(--text-muted); margin-left: auto; font-size: 0.75rem; }
.agent-dropdown-title { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); padding: 4px 12px; text-transform: uppercase; }

.send-btn {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--text), #333); color: var(--surface);
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:hover { transform: scale(1.05); background: linear-gradient(135deg, var(--primary), #3b82f6); box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; background: var(--text); box-shadow: none; }

.input-footer {
  display: flex; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--border);
  font-size: 0.75rem; color: var(--text-muted); background: rgba(0,0,0,0.01); border-radius: 0 0 16px 16px;
}
.mode-label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* FILE UPLOAD PREVIEW */
.upload-preview { padding: 12px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.upload-files { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-file-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface-hover);
  border-radius: var(--radius-sm); font-size: 0.85rem; border: 1px solid var(--border); position: relative;
}
.upload-file-item img { width: 24px; height: 24px; object-fit: cover; border-radius: 4px; }
.upload-file-item .remove-file {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: #ef4444; color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; cursor: pointer;
}

/* BUILD PROGRESS */
.build-progress { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(253, 252, 251, 0.9); backdrop-filter: blur(8px); z-index: 100; display: flex; align-items: center; justify-content: center; }
.bp-inner { background: var(--surface); padding: 32px 48px; border-radius: 24px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 16px; animation: scaleIn 0.3s ease; }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bp-spinner { width: 40px; height: 40px; border: 3px solid var(--surface-hover); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bp-inner span { font-size: 1.1rem; font-weight: 500; }
.bp-cancel { margin-top: 8px; padding: 6px 16px; background: var(--surface-hover); border-radius: 999px; font-size: 0.9rem; transition: var(--transition); }
.bp-cancel:hover { background: #fee2e2; color: #ef4444; }

/* DRAG OVERLAY */
.drag-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(66, 103, 255, 0.1); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; transition: var(--transition); border: 4px dashed var(--primary); }
.drag-content { background: var(--surface); padding: 40px; border-radius: 20px; box-shadow: var(--shadow-lg); text-align: center; color: var(--primary); animation: scaleIn 0.2s ease; }
.drag-content h3 { font-size: 1.5rem; margin: 16px 0 8px; }
.drag-content p { color: var(--text-muted); }

/* VIEWS & GRIDS */
.view-header { padding: 40px; border-bottom: 1px solid var(--border); }
.view-header h2 { font-size: 2rem; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.5px; }
.view-sub { color: var(--text-muted); font-size: 1rem; margin-bottom: 24px; }

.projects-grid { padding: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; overflow-y: auto; }
.projects-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.projects-empty h3 { color: var(--text); font-size: 1.25rem; margin-bottom: 8px; }

.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; transition: var(--transition); box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.pc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.pc-icon { width: 48px; height: 48px; background: rgba(66, 103, 255, 0.1); color: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.pc-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.pc-desc { font-size: 0.9rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 16px; flex: 1; }
.pc-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 16px; font-size: 0.8rem; color: var(--text-muted); }
.pc-dl-btn { background: var(--primary); color: white; padding: 6px 12px; border-radius: 999px; text-decoration: none; font-weight: 500; transition: var(--transition); }
.pc-dl-btn:hover { background: var(--primary-hover); transform: scale(1.05); }

/* PROJECT MODAL */
.project-modal { max-width: 900px; width: 95%; height: 85vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pm-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; background: var(--surface); }
.pm-header h2 { font-size: 1.5rem; margin: 0 0 8px; }
.pm-meta { display: flex; gap: 12px; }
.type-badge, .expiry-badge { padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.type-badge { background: rgba(66, 103, 255, 0.1); color: var(--primary); }
.expiry-badge { background: #fee2e2; color: #b91c1c; }
.close-btn { background: var(--surface-hover); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.close-btn:hover { background: #e4e4e7; }

.pm-body { display: flex; flex: 1; overflow: hidden; }
.pm-sidebar { width: 250px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface-hover); }
.file-tree { flex: 1; overflow-y: auto; padding: 12px 0; }
.tree-item { padding: 8px 16px; font-size: 0.9rem; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.tree-item:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.tree-item.active { background: var(--surface); color: var(--primary); font-weight: 500; border-left: 3px solid var(--primary); }
.tree-item svg { width: 16px; height: 16px; }
.dl-btn { margin: 16px; padding: 12px; border-radius: var(--radius); text-decoration: none; }

.pm-preview { flex: 1; display: flex; flex-direction: column; background: var(--surface); }
.pm-preview-header { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 0.95rem; }
.pm-langs { display: flex; gap: 8px; }
.lang-badge { padding: 2px 8px; background: var(--surface-hover); border-radius: 4px; font-size: 0.75rem; font-family: var(--font-mono); }
.pm-code { flex: 1; margin: 0; padding: 20px; overflow: auto; background: #0c0c0c; color: #f8fafc; font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.6; }

.pm-stats { padding: 12px 24px; border-top: 1px solid var(--border); background: var(--surface-hover); display: flex; gap: 24px; font-size: 0.85rem; color: var(--text-muted); }

/* ADMIN */
.admin-stats { padding: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; background: var(--surface-hover); border-bottom: 1px solid var(--border); }
.stat-card { background: var(--surface); padding: 20px; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-card h4 { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; margin-bottom: 8px; }
.stat-card .val { font-size: 2rem; font-weight: 600; color: var(--primary); }
.admin-users-header { padding: 40px 40px 20px; display: flex; justify-content: space-between; align-items: center; }
.admin-users-header input { max-width: 300px; }
.admin-table-wrap { padding: 0 40px 40px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--surface-hover); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; color: var(--text-muted); }
.admin-table tr:hover td { background: var(--surface-hover); }
.admin-btn { padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; background: var(--surface-hover); transition: var(--transition); margin-right: 8px; }
.admin-btn:hover { background: #e4e4e7; }
.admin-btn.danger:hover { background: #fee2e2; color: #ef4444; }

/* UTILS */
.loader-sniper {
  width: 24px; height: 24px; border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle;
}
.typing-indicator { display: inline-flex; gap: 4px; padding: 4px 8px; }
.typing-indicator span { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; z-index: 1000; box-shadow: var(--shadow-lg); }
  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; display: none; }
  .sidebar-overlay.active { display: block; }
  .sidebar-collapse-btn { display: none; }
  
  .input-bar { padding: 10px; }
  .input-wrapper { border-radius: 12px; }
  .welcome-title { font-size: 2rem; }
  
  .pm-body { flex-direction: column; }
  .pm-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
}
