/* Cursor-inspired dark theme */

:root {
  --bg-base: #09090b;
  --bg-sidebar: #0c0c0e;
  --bg-panel: #111113;
  --bg-elevated: #18181b;
  --bg-hover: #27272a;
  --bg-input: #141416;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.16);
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-dim: rgba(139, 92, 246, 0.12);
  --mode-text: #818cf8;
  --mode-text-dim: rgba(129, 140, 248, 0.12);
  --mode-image: #34d399;
  --mode-image-dim: rgba(52, 211, 153, 0.12);
  --mode-video: #fbbf24;
  --mode-video-dim: rgba(251, 191, 36, 0.12);
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --user-bg: #1c1c22;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Vazirmatn", "Inter", system-ui, -apple-system, sans-serif;
  --font-en: "Inter", system-ui, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
}



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



html, body {

  height: 100%;

  font-family: var(--font);

  background: var(--bg-base);

  color: var(--text-primary);

  overflow: hidden;

  -webkit-font-smoothing: antialiased;

  -moz-osx-font-smoothing: grayscale;

  letter-spacing: -0.01em;

}



.app {

  display: flex;

  height: 100vh;

}



/* ── Sidebar ── */

.sidebar {

  width: 260px;

  min-width: 260px;

  background: var(--bg-sidebar);

  border-left: 1px solid var(--border);

  display: flex;

  flex-direction: column;

}



.sidebar-header {

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: 14px 12px;

  border-bottom: 1px solid var(--border);

}



.logo {

  font-weight: 600;

  font-size: 14px;

  color: var(--text-primary);

}

.btn-home svg {
  color: var(--accent);
}

.btn-home:hover svg {
  color: var(--accent-hover);
}



.btn-icon {

  background: transparent;

  border: 1px solid var(--border);

  border-radius: var(--radius-sm);

  color: var(--text-secondary);

  width: 28px;

  height: 28px;

  cursor: pointer;

  display: flex;

  align-items: center;

  justify-content: center;

  transition: all 0.15s;

}



.btn-icon:hover {

  background: var(--bg-hover);

  color: var(--text-primary);

  border-color: var(--border-focus);

}



.sidebar-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px;
  min-height: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 8px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-en);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0;
}

.section-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-filters {
  display: flex;
  gap: 3px;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.conv-filter {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.conv-filter:hover { color: var(--text-secondary); background: rgba(255,255,255,0.04); }
.conv-filter.active { background: var(--bg-hover); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.conv-filter-text.active { color: var(--mode-text); }
.conv-filter-image.active { color: var(--mode-image); }
.conv-filter-video.active { color: var(--mode-video); }

.conversation-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0 2px 0 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.conversation-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.conv-group { margin-bottom: 12px; }
.conv-group:last-child { margin-bottom: 0; }

.conv-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px 6px;
  font-family: var(--font-en);
}
.conv-group-label.cat-text { color: var(--mode-text); }
.conv-group-label.cat-image { color: var(--mode-image); }
.conv-group-label.cat-video { color: var(--mode-video); }

.conv-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 2px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.conv-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.conv-row.active {
  background: var(--accent-dim);
  border-color: rgba(139, 92, 246, 0.25);
}

.conv-row.active.conv-cat-text { background: var(--mode-text-dim); border-color: rgba(129,140,248,0.25); }
.conv-row.active.conv-cat-image { background: var(--mode-image-dim); border-color: rgba(52,211,153,0.25); }
.conv-row.active.conv-cat-video { background: var(--mode-video-dim); border-color: rgba(251,191,36,0.25); }

.conv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 9px 6px 9px 10px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  text-align: right;
  font-family: var(--font);
  color: inherit;
  background: transparent;
}

.conv-delete {
  flex-shrink: 0;
  width: 28px;
  margin: 6px 4px 6px 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.conv-row:hover .conv-delete,
.conv-row.active .conv-delete {
  opacity: 1;
}

.conv-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.conv-delete:active {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(0.94);
}

.conv-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.conv-icon.cat-text { background: var(--mode-text-dim); border-color: rgba(129,140,248,0.15); color: var(--mode-text); }
.conv-icon.cat-image { background: var(--mode-image-dim); border-color: rgba(52,211,153,0.15); color: var(--mode-image); }
.conv-icon.cat-video { background: var(--mode-video-dim); border-color: rgba(251,191,36,0.15); color: var(--mode-video); }

.conv-icon svg { width: 13px; height: 13px; }

.conv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.conv-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.conv-cat { font-weight: 500; }
.conv-cat-text .conv-cat { color: var(--mode-text); }
.conv-cat-image .conv-cat { color: var(--mode-image); }
.conv-cat-video .conv-cat { color: var(--mode-video); }

.conv-dot { opacity: 0.5; }
.conv-time { font-family: var(--font-en); }

.conv-empty {
  text-align: center;
  padding: 24px 12px;
  font-size: 12px;
  color: var(--text-muted);
}



.sidebar-footer {

  padding: 10px 12px;

  border-top: 1px solid var(--border);

}



.health-status {

  font-size: 11px;

  font-family: var(--font-en);

  color: var(--text-muted);

  display: flex;

  align-items: center;

  gap: 6px;

}



.dot {

  width: 7px;

  height: 7px;

  border-radius: 50%;

  flex-shrink: 0;

}

.dot-ok { background: var(--success); }

.dot-error { background: var(--error); }

.dot-pending { background: var(--warning); animation: pulse 1.5s infinite; }



@keyframes pulse {

  0%, 100% { opacity: 1; }

  50% { opacity: 0.4; }

}



/* ── Main ── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.08), transparent),
    var(--bg-base);
}



.topbar {

  display: flex;

  align-items: stretch;

  justify-content: space-between;

  gap: 8px;

  padding: 0 12px;

  height: 42px;

  border-bottom: 1px solid var(--border);

  background: var(--bg-panel);

}



.topbar-home {
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
}

.topbar-tabs-wrap {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  gap: 4px;
}

.chat-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-tabs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.chat-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  min-width: 96px;
  height: 34px;
  padding: 0 6px 0 10px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  margin-top: 6px;
}

.chat-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.chat-tab.active {
  background: var(--bg-base);
  border-color: var(--border);
  color: var(--text-primary);
}

.chat-tab-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.chat-tab-icon svg {
  width: 13px;
  height: 13px;
}

.chat-tab.cat-text .chat-tab-icon { color: var(--mode-text); }
.chat-tab.cat-image .chat-tab-icon { color: var(--mode-image); }
.chat-tab.cat-video .chat-tab-icon { color: var(--mode-video); }

.chat-tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
}

.chat-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0;
  color: var(--text-muted);
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.chat-tab:hover .chat-tab-close,
.chat-tab.active .chat-tab-close {
  opacity: 0.55;
}

.chat-tab-close:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-tab-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 8px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-tab-new:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}



.topbar-title {

  font-size: 14px;

  font-weight: 500;

  color: var(--text-primary);

}



.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 4px;
}

.user-menu-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.user-avatar {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-hover);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.user-dropdown.hidden { display: none; }

.user-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 6px;
}

.user-dropdown-sub {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.user-dropdown-link {
  display: block;
  padding: 8px 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
}

.user-dropdown-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-dropdown-link.muted { color: var(--text-muted); }

.nav-item.hidden { display: none; }
.category-card.hidden { display: none; }

.user-menu {
  position: relative;
}

.queue-badge {
  font-size: 11px;
  font-family: var(--font-en);
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent-hover);
  border: 1px solid rgba(124, 106, 239, 0.3);
}

.queue-badge.hidden { display: none; }



/* ── Chat area ── */

.chat-area {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-area::-webkit-scrollbar { width: 4px; }



.welcome {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  padding: 48px 32px 20px;
  text-align: center;
}

.welcome-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-dim);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-hover);
  margin-bottom: 20px;
}

.welcome h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.welcome p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 440px;
  margin-bottom: 36px;
  line-height: 1.6;
}

.init-error {
  width: 100%;
  max-width: 440px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
}



/* Sidebar nav */

.sidebar-nav {

  padding: 12px 10px 14px;

  border-bottom: 1px solid var(--border);

}



.nav-section-label {

  font-size: 10px;

  font-weight: 600;

  font-family: var(--font-en);

  text-transform: uppercase;

  letter-spacing: 0.08em;

  color: var(--text-muted);

  padding: 0 10px 8px;

}



.nav-list {

  display: flex;

  flex-direction: column;

  gap: 4px;

}



.nav-item {

  position: relative;

  display: flex;

  align-items: center;

  gap: 12px;

  padding: 10px 12px;

  border: 1px solid transparent;

  border-radius: 10px;

  background: transparent;

  color: var(--text-secondary);

  font-family: var(--font);

  cursor: pointer;

  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;

  text-align: right;

  width: 100%;

  overflow: hidden;

}



.nav-indicator {

  position: absolute;

  right: 0;

  top: 50%;

  transform: translateY(-50%);

  width: 3px;

  height: 0;

  border-radius: 3px 0 0 3px;

  background: var(--nav-accent, var(--accent));

  transition: height 0.2s ease;

}



.nav-icon-wrap {

  width: 34px;

  height: 34px;

  border-radius: 9px;

  display: flex;

  align-items: center;

  justify-content: center;

  flex-shrink: 0;

  background: var(--nav-icon-bg, rgba(255,255,255,0.04));

  color: var(--nav-icon-color, var(--text-muted));

  border: 1px solid var(--nav-icon-border, transparent);

  transition: all 0.18s ease;

}



.nav-text {

  display: flex;

  flex-direction: column;

  gap: 2px;

  min-width: 0;

  flex: 1;

}



.nav-title {

  font-size: 13px;

  font-weight: 600;

  color: var(--text-primary);

  line-height: 1.2;

}



.nav-sub {

  font-size: 10px;

  color: var(--text-muted);

  line-height: 1.3;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;

}



/* Mode accents */

.nav-item-text {

  --nav-accent: #818cf8;

  --nav-icon-bg: rgba(129, 140, 248, 0.1);

  --nav-icon-color: #a5b4fc;

  --nav-icon-border: rgba(129, 140, 248, 0.18);

}



.nav-item-image {

  --nav-accent: #34d399;

  --nav-icon-bg: rgba(52, 211, 153, 0.1);

  --nav-icon-color: #6ee7b7;

  --nav-icon-border: rgba(52, 211, 153, 0.18);

}



.nav-item-video {

  --nav-accent: #fbbf24;

  --nav-icon-bg: rgba(251, 191, 36, 0.1);

  --nav-icon-color: #fcd34d;

  --nav-icon-border: rgba(251, 191, 36, 0.18);

}



.nav-item:hover {

  background: rgba(255, 255, 255, 0.03);

  border-color: var(--border);

  color: var(--text-primary);

}



.nav-item:hover .nav-icon-wrap {

  transform: scale(1.04);

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

}



.nav-item.active {

  background: linear-gradient(90deg, rgba(255,255,255,0.02), var(--nav-icon-bg));

  border-color: var(--nav-icon-border);

  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);

}



.nav-item.active .nav-indicator {

  height: 22px;

}



.nav-item.active .nav-icon-wrap {

  background: var(--nav-icon-bg);

  border-color: var(--nav-icon-border);

  color: var(--nav-icon-color);

}



.nav-item.active .nav-title {

  color: #fff;

}



.nav-item.active .nav-sub {

  color: var(--text-secondary);

}



/* Topbar back */

.topbar-left {

  display: flex;

  align-items: center;

  gap: 10px;

}



.btn-back {

  background: transparent;

  border: 1px solid var(--border);

  border-radius: var(--radius-sm);

  color: var(--text-secondary);

  width: 28px;

  height: 28px;

  cursor: pointer;

  display: flex;

  align-items: center;

  justify-content: center;

  transition: all 0.15s;

  flex-shrink: 0;

}



.btn-back:hover {

  background: var(--bg-hover);

  color: var(--text-primary);

  border-color: var(--border-focus);

}



/* Category cards (home) */
.category-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  width: 100%;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: right;
  font-family: var(--font);
  color: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.category-card:hover {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.cat-text .cc-icon-wrap { background: var(--mode-text-dim); color: var(--mode-text); border-color: rgba(129,140,248,0.2); }
.cat-image .cc-icon-wrap { background: var(--mode-image-dim); color: var(--mode-image); border-color: rgba(52,211,153,0.2); }
.cat-video .cc-icon-wrap { background: var(--mode-video-dim); color: var(--mode-video); border-color: rgba(251,191,36,0.2); }

.cat-text:hover { border-color: rgba(129,140,248,0.35); }
.cat-image:hover { border-color: rgba(52,211,153,0.35); }
.cat-video:hover { border-color: rgba(251,191,36,0.35); }

.cc-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cc-body { flex: 1; min-width: 0; }
.cc-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; color: var(--text-primary); }
.cc-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; margin-bottom: 8px; }

.cc-models { display: flex; flex-wrap: wrap; gap: 5px; }
.cc-chip {
  font-size: 10px;
  font-family: var(--font-en);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.cc-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.2s, transform 0.2s;
}

.category-card:hover .cc-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Workspace */
.workspace-panel {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 24px;
  animation: wsIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.studio-ws {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.ws-text { --ws-c: var(--mode-text); --ws-d: var(--mode-text-dim); }
.ws-image { --ws-c: var(--mode-image); --ws-d: var(--mode-image-dim); }
.ws-video { --ws-c: var(--mode-video); --ws-d: var(--mode-video-dim); }

.sw-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--ws-d) 0%, transparent 100%);
}

.sw-head-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ws-d);
  color: var(--ws-c);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sw-head-icon svg { width: 22px; height: 22px; }

.sw-head-text h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.sw-head-text p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.sw-panel {
  background: var(--bg-panel);
  padding: 18px 20px;
}

.sw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-en);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sw-count {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font);
  color: var(--text-muted);
  opacity: 0.8;
}

.sw-model-list { display: flex; flex-direction: column; gap: 6px; }

.sw-model {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: right;
  font-family: var(--font);
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.sw-model:hover { border-color: rgba(255,255,255,0.12); }
.sw-model.active {
  border-color: var(--ws-c);
  background: var(--ws-d);
}

.sw-model-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-focus);
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
  position: relative;
}

.sw-model.active .sw-model-radio {
  border-color: var(--ws-c);
  background: var(--ws-c);
  box-shadow: inset 0 0 0 3px var(--bg-panel);
}

.sw-model-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sw-model-body strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sw-model-body span {
  font-size: 10px;
  font-family: var(--font-en);
  color: var(--text-muted);
}

.sw-model-body em {
  font-size: 11px;
  font-style: normal;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
}

.sw-steps { display: flex; flex-direction: column; gap: 8px; }

.sw-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.sw-step-n {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--ws-d);
  color: var(--ws-c);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-en);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sw-step p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding-top: 2px;
}

.sw-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sw-foot-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-en);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 6px;
}

.sw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.sw-tag {
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.sw-tag:hover {
  border-color: var(--ws-c);
  color: var(--text-primary);
  background: var(--ws-d);
}

/* Category icon colors (composer, dropdown, messages) */
.cat-text { color: var(--mode-text); }
.cat-image { color: var(--mode-image); }
.cat-video { color: var(--mode-video); }

.model-icon, .mo-icon, .msg-avatar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.model-icon {
  width: 18px;
  height: 18px;
}

.model-icon svg, .mo-icon svg, .msg-avatar-icon svg {
  width: 14px;
  height: 14px;
}

.mo-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
}

.msg-avatar-icon {
  width: 100%;
  height: 100%;
}

.msg-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}



/* Messages */

.messages {

  padding: 20px;

  max-width: 820px;

  margin: 0 auto;

  width: 100%;

}



.messages:empty { display: none; }

.welcome.hidden { display: none; }



.message {

  display: flex;

  gap: 12px;

  margin-bottom: 24px;

  animation: fadeIn 0.25s ease;

}



@keyframes fadeIn {

  from { opacity: 0; transform: translateY(6px); }

  to { opacity: 1; transform: translateY(0); }

}

.message-highlight .msg-body {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.55);
  border-radius: 10px;
  animation: msgPulse 2.5s ease;
}

@keyframes msgPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.55); }
  50% { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25); }
}



.msg-avatar {

  width: 28px;

  height: 28px;

  border-radius: var(--radius-sm);

  display: flex;

  align-items: center;

  justify-content: center;

  font-size: 14px;

  flex-shrink: 0;

  margin-top: 2px;

}



.message.user .msg-avatar { background: var(--accent-dim); }

.message.assistant .msg-avatar { background: var(--bg-elevated); border: 1px solid var(--border); }



.msg-body { flex: 1; min-width: 0; }



.msg-header {

  display: flex;

  align-items: center;

  gap: 8px;

  margin-bottom: 6px;

}



.msg-role {

  font-size: 12px;

  font-weight: 600;

  color: var(--text-secondary);

}



.msg-model {

  font-size: 10px;

  font-family: var(--font-en);

  padding: 1px 6px;

  border-radius: 4px;

  background: var(--bg-elevated);

  color: var(--text-muted);

  border: 1px solid var(--border);

}



.msg-content {

  font-size: 14px;

  line-height: 1.65;

  color: var(--text-primary);

  white-space: pre-wrap;

  word-break: break-word;

}



.msg-content.pending {

  color: var(--text-muted);

  font-style: italic;

}



.msg-content.error { color: var(--error); }



.msg-media {

  margin-top: 10px;

  border-radius: var(--radius);

  overflow: hidden;

  border: 1px solid var(--border);

  max-width: 100%;

}



.msg-media img {

  display: block;

  max-width: 100%;

  max-height: 480px;

  object-fit: contain;

  background: var(--bg-elevated);

}



.msg-media video {

  display: block;

  max-width: 100%;

  max-height: 480px;

  background: #000;

}



.msg-status {

  margin-top: 6px;

  font-size: 11px;

  color: var(--text-muted);

  display: flex;

  align-items: center;

  gap: 6px;

}



.spinner {

  width: 12px;

  height: 12px;

  border: 2px solid var(--border);

  border-top-color: var(--accent);

  border-radius: 50%;

  animation: spin 0.7s linear infinite;

}



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



/* ── Composer ── */

.composer-wrap {

  padding: 12px 20px 8px;

  background: var(--bg-base);

  border-top: 1px solid var(--border);

}



.queue-bar {
  max-width: 820px;
  margin: 0 auto 8px;
}

.queue-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.queue-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.queue-bar-text { flex: 1; }

.queue-bar-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-en);
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent-hover);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

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

.queue-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-list.hidden { display: none; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg-elevated, var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.queue-item:hover,
.queue-item:focus-visible {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.06);
  outline: none;
}

.queue-item-running {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
}

.queue-item-status {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.queue-item-status.running {
  color: var(--accent-hover);
  background: var(--accent-dim);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.queue-item-status.pending {
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.queue-item-body {
  flex: 1;
  min-width: 0;
}

.queue-item-prompt {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.queue-item-cat {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.queue-item-cat.cat-text {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.queue-item-cat.cat-image {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.queue-item-cat.cat-video {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.queue-item-model {
  color: var(--text-muted);
}

.queue-item-cancel {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  position: relative;
  z-index: 1;
}

.queue-item-cancel:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
}



.toolbar-label {

  font-size: 11px;

  color: var(--text-muted);

  white-space: nowrap;

  flex-shrink: 0;

}



.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  align-self: stretch;
  padding-bottom: 8px;
}

.attachment-preview.hidden { display: none; }

.attachment-thumb-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.attachment-preview img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.btn-remove-attach {
  position: absolute;
  top: -5px;
  inset-inline-start: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.attachment-thumb-wrap:hover .btn-remove-attach,
.btn-remove-attach:focus-visible {
  opacity: 1;
}

.btn-remove-attach:hover {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}



.composer {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: visible;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.composer:focus-within {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 0 3px var(--accent-dim);
}



.composer-toolbar {

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: 6px 12px;

  border-bottom: 1px solid var(--border);

  flex-wrap: nowrap;

  gap: 12px;

}



/* Model selector — Cursor style */

.model-selector {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}



.model-btn {

  display: flex;

  align-items: center;

  gap: 6px;

  background: var(--bg-elevated);

  border: 1px solid var(--border);

  border-radius: var(--radius-sm);

  padding: 5px 10px;

  cursor: pointer;

  color: var(--text-primary);

  font-size: 12px;

  transition: all 0.12s;

}



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



.model-name { font-weight: 500; }



.model-tag {

  font-size: 10px;

  font-family: var(--font-en);

  font-weight: 600;

  letter-spacing: 0.03em;

  padding: 1px 5px;

  border-radius: 3px;

  background: var(--accent-dim);

  color: var(--accent-hover);

}



.chevron { color: var(--text-muted); margin-right: 2px; }



.model-dropdown {

  position: absolute;

  bottom: calc(100% + 6px);

  right: 0;

  width: 320px;

  background: var(--bg-elevated);

  border: 1px solid var(--border);

  border-radius: var(--radius);

  box-shadow: 0 8px 32px rgba(0,0,0,0.5);

  z-index: 100;

  overflow: hidden;

  max-height: 380px;

  overflow-y: auto;

}



.model-dropdown.hidden { display: none; }



.dropdown-group-label {

  font-size: 10px;

  font-weight: 600;

  font-family: var(--font-en);

  text-transform: uppercase;

  letter-spacing: 0.07em;

  color: var(--text-muted);

  padding: 10px 12px 4px;

}



.model-option {

  display: flex;

  align-items: flex-start;

  gap: 10px;

  padding: 10px 12px;

  cursor: pointer;

  transition: background 0.1s;

}



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

.model-option.selected { background: var(--accent-dim); }



.model-option .mo-icon { margin-top: 1px; }

.model-option .mo-info { flex: 1; }

.model-option .mo-name { font-size: 13px; font-weight: 500; }

.model-option .mo-en { font-size: 11px; color: var(--text-muted); font-family: var(--font-en); }

.model-option .mo-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }



.composer-options {

  display: flex;

  align-items: center;

  gap: 10px;

  flex-wrap: nowrap;

  flex-shrink: 0;

}



.opt-toggle, .opt-size {

  display: flex;

  align-items: center;

  gap: 4px;

  font-size: 11px;

  color: var(--text-muted);

}



/* Compact param fields — segmented control */

.opt-params-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.opt-params-group.hidden { display: none; }

.opt-params {
  display: flex;
  align-items: stretch;
  height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.opt-params:focus-within {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.opt-field {
  display: flex;
  align-items: center;
  border-inline-start: 1px solid var(--border);
  cursor: text;
  transition: background 0.12s;
}

.opt-field:first-child { border-inline-start: none; }

.opt-field:hover { background: rgba(255, 255, 255, 0.02); }

.opt-field:focus-within { background: rgba(255, 255, 255, 0.03); }

.opt-field.hidden { display: none; }

.opt-field input {
  width: 44px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
  padding: 0 6px 0 8px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

#opt-length-wrap input { width: 36px; }

.opt-field input::-webkit-outer-spin-button,
.opt-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.opt-field-label {
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-en);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px 0 6px;
  background: rgba(255, 255, 255, 0.03);
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
  border-inline-start: 1px solid var(--border);
}



.opt-toggle.hidden, .opt-field.hidden { display: none; }



.composer-input-area {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

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



.btn-attach {

  display: flex;

  align-items: center;

  justify-content: center;

  width: 32px;

  height: 32px;

  border-radius: var(--radius-sm);

  color: var(--text-muted);

  cursor: pointer;

  transition: all 0.12s;

  flex-shrink: 0;

}



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



#prompt-input {

  flex: 1;

  min-width: 0;

  background: transparent;

  border: none;

  outline: none;

  color: var(--text-primary);

  font-size: 14px;

  font-family: var(--font);

  resize: none;

  line-height: 1.5;

  max-height: 160px;

  min-height: 24px;

  direction: rtl;

  text-align: start;

}



#prompt-input::placeholder { color: var(--text-muted); }



.btn-send {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.btn-send:hover { background: var(--accent-hover); }

.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-send.is-stop {
  background: var(--bg-elevated);
  border: 1px solid var(--border-focus);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-send.is-stop:hover {
  background: #3f1212;
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.msg-content.cancelled {
  color: var(--text-muted);
  font-style: italic;
}



.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px 0 4px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}



.hidden { display: none !important; }

/* Confirm modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalIn 0.2s ease;
}

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

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.modal-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
}

.modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
  cursor: pointer;
}

.modal-check input {
  accent-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}

.modal-btn-cancel {
  background: transparent;
  color: var(--text-secondary);
}

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

.modal-btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.modal-btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}



/* Scrollbar — thin, minimal (Cursor-like) */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

::-webkit-scrollbar-button,
::-webkit-scrollbar-corner {
  display: none;
  width: 0;
  height: 0;
}

/* Responsive */

@media (max-width: 768px) {
  .sidebar { display: none; }
  .composer-options { display: none; }
  .sw-grid { grid-template-columns: 1fr; }
  .sw-foot { flex-direction: column; gap: 8px; }
  .workspace-panel { padding: 16px 12px; }
}

