/* ============================================================
   AI Помощник — ComUnify
   Production CSS — Dark theme, mobile-first
   ============================================================ */

/* ==================== CSS Variables ==================== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #1a2540;
  --bg-active: rgba(99, 102, 241, 0.12);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #ffffff;

  --brand: #6366f1;
  --brand-light: #818cf8;
  --brand-lighter: #a5b4fc;
  --brand-dark: #4f46e5;
  --brand-bg: rgba(99, 102, 241, 0.15);
  --brand-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

  --telegram: #0088cc;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;

  --border: #1e293b;
  --border-light: #334155;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

  --sidebar-width: 260px;
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --input-bar-height: auto;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ==================== Reset ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--brand-lighter);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
}

/* ==================== Toast notifications ==================== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 300ms ease forwards;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

.toast.error {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #991b1b;
}
.toast.success {
  background: #14532d;
  color: #86efac;
  border: 1px solid #166534;
}
.toast.info {
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #1e40af;
}

.toast.out {
  animation: toastOut 250ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ==================== Login screen ==================== */
.login-screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}

.login-screen.visible {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: fadeInUp 400ms ease;
}

.login-logo {
  width: 72px;
  height: 72px;
  background: var(--brand-gradient);
  border-radius: var(--radius-xl);
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-error {
  display: none;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.2);
  text-align: left;
}
.login-error.visible {
  display: block;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.login-divider span {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-footer {
  margin-top: 24px;
}
.login-footer a {
  font-size: 13px;
  color: var(--brand-light);
}

/* ==================== Forms ==================== */
.form-group {
  margin-bottom: 12px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.input::placeholder {
  color: var(--text-tertiary);
}

.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.btn-telegram {
  background: var(--telegram);
  color: white;
}
.btn-telegram:hover {
  background: #0077b5;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== App layout ==================== */
.app {
  display: none;
  height: 100%;
  overflow: hidden;
}

.app.visible {
  display: flex;
}

/* ==================== Sidebar ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  text-align: left;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--brand-bg);
  color: var(--brand-light);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.nav-badge, .mobile-badge {
  background: var(--brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.user-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  backdrop-filter: blur(4px);
}

/* ==================== Main content ==================== */
.main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ==================== Panels ==================== */
.panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Hide sidebar toggle on desktop */
.sidebar-toggle {
  display: none;
}

/* ==================== Chat ==================== */
.chat-header {
  display: flex;
  justify-content: space-between;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Mode bar */
.mode-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mode-bar::-webkit-scrollbar {
  display: none;
}

.mode-chip {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.mode-chip:hover {
  border-color: var(--brand);
  color: var(--text-primary);
}
.mode-chip.active {
  background: var(--brand-bg);
  border-color: var(--brand);
  color: var(--brand-lighter);
}

.project-select {
  margin-left: auto;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  max-width: 200px;
}
.project-select:focus {
  border-color: var(--brand);
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  scroll-behavior: smooth;
}

.welcome-message {
  text-align: center;
  padding: 60px 20px;
  max-width: 400px;
  margin: auto;
  animation: fadeIn 500ms ease;
}
.welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.welcome-message h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.welcome-message p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.msg {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: msgIn 200ms ease;
}

.msg.user {
  background: var(--brand);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  background: var(--bg-secondary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.msg-content {
  white-space: pre-wrap;
}

.msg-time {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  text-align: right;
}

.msg.assistant .msg-time {
  text-align: left;
}

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

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  display: flex;
  gap: 4px;
  align-items: center;
  animation: msgIn 200ms ease;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: typingBounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 200ms; }
.typing-dot:nth-child(3) { animation-delay: 400ms; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input bar */
.input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-primary);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-wrapper:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 0;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 24px;
}
.chat-input::placeholder {
  color: var(--text-tertiary);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.send-btn:hover:not(:disabled) {
  background: var(--brand-dark);
}
.send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.input-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 6px;
}

/* History drawer */
.history-drawer {
  width: 300px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.history-drawer.open {
  display: flex;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.history-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.history-item:hover {
  background: var(--bg-hover);
}
.history-item.active {
  background: var(--brand-bg);
}

.history-icon {
  font-size: 18px;
  flex-shrink: 0;
}

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

.history-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ==================== Projects ==================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  flex: 1;
}
.projects-grid:has(.empty-state) {
  display: flex;
}

.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.project-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-card-name {
  font-size: 16px;
  font-weight: 700;
}

.project-card-actions {
  display: flex;
  gap: 4px;
}

.project-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.project-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Create form */
.create-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
  animation: fadeInUp 300ms ease;
}
.create-form h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ==================== Tasks ==================== */
.task-filters {
  display: flex;
  gap: 6px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.filter-chip:hover {
  color: var(--text-secondary);
}
.filter-chip.active {
  background: var(--brand-bg);
  color: var(--brand-lighter);
  border-color: var(--brand);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.task-item:hover {
  border-color: var(--border-light);
}
.task-item.done {
  opacity: 0.5;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1px;
}
.task-checkbox:hover {
  border-color: var(--brand);
}
.task-item.done .task-checkbox {
  background: var(--success);
  border-color: var(--success);
}
.task-item.done .task-checkbox::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.task-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.task-session-badge {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 2px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ==================== Settings ==================== */
.settings-content {
  max-width: 600px;
  margin: 0 auto;
}

.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.settings-card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-card-body {
  padding: 16px 20px;
}

.settings-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  line-height: 1.5;
}
.settings-hint a {
  color: var(--brand-light);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-info {
  min-width: 0;
}

.profile-name {
  font-size: 17px;
  font-weight: 700;
}

.profile-username {
  font-size: 13px;
  color: var(--text-tertiary);
}

.key-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.key-input-row .input {
  flex: 1;
}

.keys-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.key-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== Coming soon ==================== */
.coming-soon {
  text-align: center;
  padding: 60px 20px;
  max-width: 440px;
  margin: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.coming-soon h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.coming-soon p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.coming-soon-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
}

.feature-icon {
  font-size: 18px;
}

.coming-soon-badge {
  display: inline-block;
  padding: 6px 20px;
  background: var(--brand-bg);
  color: var(--brand-lighter);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ==================== Empty states ==================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 200px;
}
.empty-state.small {
  padding: 24px 12px;
  font-size: 13px;
  min-height: 100px;
}
.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 14px;
  line-height: 1.5;
}

/* ==================== Loading skeleton ==================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ==================== Bottom navigation ==================== */
.bottom-nav {
  display: none;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  height: var(--bottom-nav-height);
  flex-shrink: 0;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
  position: relative;
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--brand-light);
}

.bottom-nav-icon {
  font-size: 20px;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
}

.mobile-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  font-size: 9px;
  padding: 0 4px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Panel transitions */
.panel.active {
  animation: fadeIn 200ms ease;
}

/* ==================== Desktop label in button ==================== */
.btn-label-desktop {
  display: none;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ==================== Mobile (< 768px) ==================== */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .bottom-nav {
    display: flex;
  }

  .input-hint {
    display: none;
  }

  .history-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: 100%;
    max-width: 320px;
    box-shadow: var(--shadow-lg);
  }

  .msg {
    max-width: 88%;
  }

  .mode-bar {
    padding: 8px 12px;
    gap: 6px;
  }

  .mode-chip {
    padding: 6px 10px;
    font-size: 12px;
  }

  .project-select {
    display: none;
  }

  .messages {
    padding: 12px;
  }

  .input-bar {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

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

  .panel-content {
    padding: 16px;
  }

  .task-filters {
    gap: 4px;
  }
  .filter-chip {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ==================== Desktop (>= 768px) ==================== */
@media (min-width: 768px) {
  .bottom-nav {
    display: none !important;
  }

  .btn-label-desktop {
    display: inline;
  }
}

/* ==================== Large desktop (>= 1024px) ==================== */
@media (min-width: 1024px) {
  .history-drawer {
    width: 320px;
  }
}
