:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary: #8b5cf6;
  --secondary-dark: #7c3aed;
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;
  
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --nav-height: 60px;
  --header-height: 56px;
  
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
.dark-theme {
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2d2d2d;
  --bg-overlay: rgba(0, 0, 0, 0.7);

  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-tertiary: #737373;
  --text-inverse: #ffffff;

  --border: #3d3d3d;
  --border-light: #2d2d2d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
}

/* Auth Section */
.auth-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.dark-theme .auth-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
  color: var(--text-inverse);
}

.auth-logo {
  width: 200px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;

}

.auth-logo img {
  width: 300px;
  height: 300px;
  object-fit: contain;
}

.auth-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
}

.auth-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 15px;
}

.auth-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark-theme .form-group input:focus,
.dark-theme .form-group select:focus,
.dark-theme .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.btn-primary {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: 15px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: none;
}

.btn-secondary {
  padding: 12px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--error);
  color: var(--text-inverse);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: var(--transition);
}

.btn-danger svg {
  width: 20px;
  height: 20px;
}

.error-message {
  font-size: 13px;
  color: var(--error);
  margin: 0;
  min-height: 18px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-tertiary);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-oauth {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-oauth svg {
  width: 20px;
  height: 20px;
}

.btn-oauth:active {
  transform: scale(0.98);
}

/* Main App Layout */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding-bottom: var(--nav-height);
}

.view.active {
  display: flex;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.view-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-logo {
  width: 45px;
  height: 45px;
  object-fit: contain;
}

.view-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:active {
  background: var(--bg-secondary);
}

.btn-icon svg {
  width: 24px;
  height: 24px;
}

/* Projects View */
.projects-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.projects-list {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.project-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.project-card-badge {
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.project-card-meta svg {
  width: 14px;
  height: 14px;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-tertiary);
}

.quick-join {
  padding: 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
}

/* Chat View */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.chat-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-info h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-info p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 40px 20px;
}

.chat-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

.chat-placeholder p {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

.chat-placeholder span {
  font-size: 14px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
  animation: messageSlide 0.2s ease-out;
  margin-bottom: 4px;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  align-self: flex-end;
  align-items: flex-end;
}

.assistant-message {
  align-self: flex-start;
  align-items: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 15px;
  min-height: 20px;
}

.user-message .message-bubble {
  background: var(--primary);
  color: var(--text-inverse);
  border-bottom-right-radius: 4px;
}

.assistant-message .message-bubble {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.assistant-message.message--error .message-bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.dark-theme .assistant-message.message--error .message-bubble {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.assistant-message.message--status .message-bubble {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.dark-theme .assistant-message.message--status .message-bubble {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

.message-time {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 0 4px;
  margin-top: 2px;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.typing-indicator.visible {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

.chat-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.toolbar-pages {
  flex: 1;
}

.toolbar-pages select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.btn-tool {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-tool:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-tool:not(:disabled):active {
  background: var(--bg-secondary);
  transform: scale(0.95);
}

.btn-tool svg {
  width: 20px;
  height: 20px;
}

.new-page-panel {
  display: none;
  padding: 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.new-page-panel.visible {
  display: block;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-actions button {
  flex: 1;
}

.chat-attachments {
  padding: 0 16px;
}

.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-list.hidden {
  display: none;
}

.upload-dir-selector {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-dir-selector label {
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-dir-selector select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9em;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.upload-dir-selector select:hover {
  border-color: var(--primary-color);
}

.upload-dir-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.attachment-remove {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: var(--error);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 500;
}

.command-hint {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 20px;
}

.command-hint.command-hint--error {
  color: var(--error);
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.btn-attachment {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.btn-attachment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.btn-attachment:active {
  background: var(--bg-secondary);
}

.btn-attachment svg {
  width: 22px;
  height: 22px;
}

.chat-input-form {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-input-form textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  resize: none;
  min-height: 56px;
  max-height: 120px;
  outline: none;
  transition: var(--transition);
  line-height: 1.5;
}

.chat-input-form textarea:focus {
  border-color: var(--primary);
}

.btn-send {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-send:not(:disabled):active {
  transform: scale(0.95);
}

.btn-send svg {
  width: 20px;
  height: 20px;
}

/* Settings View */
.settings-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.profile-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.profile-avatar svg {
  width: 28px;
  height: 28px;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-email {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-since {
  font-size: 13px;
  color: var(--text-secondary);
}

.project-settings {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.settings-empty {
  margin: 0;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px;
}

.project-settings-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-info-item:last-child {
  border-bottom: none;
}

.settings-info-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.settings-info-value {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}

.settings-list {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info {
  flex: 1;
}

.setting-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}

.setting-desc {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
}

.setting-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.dark-theme .toggle-slider::before {
  background: #e5e5e5;
}

.about-info {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
}

.about-info p {
  margin: 0;
}

.about-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.settings-actions {
  padding-top: 16px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  transition: var(--transition);
  padding: 8px;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  transform: scale(1.1);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  align-items: flex-end;
  animation: fadeIn 0.2s ease-out;
}

.modal.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  width: 100%;
  max-height: 90vh;
  background: var(--bg-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.btn-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-close:active {
  transform: scale(0.95);
}

.btn-close svg {
  width: 20px;
  height: 20px;
}

.modal form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  flex: 1;
}

.modal-menu {
  max-height: 80vh;
}

.menu-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
}

.menu-section:last-child {
  border-bottom: none;
}

.menu-section h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.menu-value {
  font-size: 14px;
  font-weight: 500;
}

.share-code-badge {
  padding: 6px 12px;
  background: var(--primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.menu-button {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  transition: var(--transition);
  text-align: left;
}

.menu-button:last-child {
  margin-bottom: 0;
}

.menu-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu-button:not(:disabled):active {
  background: var(--bg-secondary);
  transform: scale(0.98);
}

.menu-button svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  transition: var(--transition);
}

.menu-link:last-child {
  margin-bottom: 0;
}

.menu-link:active {
  background: var(--bg-secondary);
  transform: scale(0.98);
}

.menu-link svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.toast.success {
  border-color: var(--success);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.info {
  border-color: var(--info);
}

.toast.info .toast-icon {
  color: var(--info);
}

.dark-theme .toast {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

/* Help Modal */
.modal-help {
  max-height: 85vh;
}

.help-content {
  padding: 20px;
  overflow-y: auto;
}

.help-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.help-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.help-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.help-section ol,
.help-section ul {
  margin: 0;
  padding-left: 24px;
  color: var(--text-secondary);
}

.help-section li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.help-section li strong {
  color: var(--text-primary);
  font-weight: 600;
}

.help-section p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Responsive */
@media (min-width: 768px) {
  .auth-section {
    padding: 40px;
  }
  
  .view {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
  
  .projects-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
  
  .toast-container {
    left: auto;
    right: 16px;
    max-width: 400px;
  }
}