/* =========================================================
   STUDIO AGENTS IA — DESIGN SYSTEM PREMIUM DARK THEME
   ========================================================= */

:root {
  --bg-main: #0a0d14;
  --bg-sidebar: #0f1422;
  --bg-card: #151c2e;
  --bg-card-hover: #1c263e;
  --bg-input: #101626;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(139, 92, 246, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.25);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-blue: #3b82f6;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.2);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

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

/* App container with full layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
              var(--bg-main);
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: 320px;
  min-width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px;
  gap: 16px;
  z-index: 10;
}

.sidebar-header {
  padding-bottom: 6px;
}

.logo-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-md);
}

.logo-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.logo-text {
  flex: 1;
}

.logo-text h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.version-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-close-sidebar {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-sidebar:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.05));
  border-left: 3px solid var(--accent-purple);
  border-color: rgba(139, 92, 246, 0.3);
}

/* Agents Section */
.agents-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding: 8px 4px;
}

.section-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
}

.btn-add-agent {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-agent:hover {
  background: var(--accent-purple);
  color: #fff;
}

.agents-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.agents-list::-webkit-scrollbar {
  width: 4px;
}
.agents-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Agent Item Card */
.agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 54px;
}

.agent-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
  transform: translateX(2px);
}

.agent-item.active {
  background: var(--bg-card);
  border-color: var(--border-active);
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.15);
}

.agent-item.orchestrator-item {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(6, 182, 212, 0.06));
  border-color: rgba(139, 92, 246, 0.28);
}

.agent-avatar-wrapper {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.agent-item-avatar {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-card);
}

.agent-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.agent-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-item-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.lead-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  letter-spacing: 0.5px;
}

.agent-item-role {
  font-size: 11.5px;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Model Selector Box */
.model-selector-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-selector-box label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-wrapper select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-wrapper select:focus {
  border-color: var(--accent-purple);
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 600;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* =========================================================
   MAIN CONTENT & VIEWS
   ========================================================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--bg-main);
  overflow: hidden;
}

.view-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
}

/* Agent Header */
.agent-header {
  padding: 16px 24px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.agent-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.agent-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-title-row h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.agent-role-pill {
  font-size: 11px;
  padding: 3px 10px;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-radius: var(--radius-full);
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-weight: 600;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.btn-action-ghost {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-ghost:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Quick Prompts Bar */
.quick-prompts-bar {
  padding: 10px 24px;
  background: rgba(15, 20, 34, 0.6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.prompt-hint {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.prompt-chips {
  display: flex;
  gap: 8px;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-chip:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-purple);
  color: #fff;
  transform: translateY(-1px);
}

/* Split Workspace */
.workspace-split {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

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

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}
.messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Message Bubble */
.message-bubble {
  display: flex;
  gap: 12px;
  max-width: 88%;
  line-height: 1.6;
}

.message-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-bubble.assistant {
  align-self: flex-start;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.msg-body {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  position: relative;
  word-break: break-word;
}

.message-bubble.user .msg-body {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.message-bubble.assistant .msg-body {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-subtle);
}

.msg-body p {
  margin-bottom: 8px;
}
.msg-body p:last-child {
  margin-bottom: 0;
}
.msg-body ul, .msg-body ol {
  margin-left: 20px;
  margin-bottom: 8px;
}
.msg-body code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}
.msg-body pre {
  background: #090d16;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid rgba(255,255,255,0.06);
}

/* Welcome Card */
.welcome-card {
  max-width: 100% !important;
  align-self: stretch !important;
}

.welcome-inner {
  background: linear-gradient(135deg, rgba(21, 28, 46, 0.9), rgba(15, 20, 34, 0.9));
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.welcome-inner h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}

.welcome-inner p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.welcome-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.mini-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-card:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.mini-card strong {
  font-size: 13px;
  color: #f8fafc;
}

.mini-card span {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Chat Input Wrapper */
.chat-input-wrapper {
  padding: 16px 24px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
}

.chat-form {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-form:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px var(--accent-purple-glow);
}

.chat-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  line-height: 1.5;
}

.form-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.input-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-send {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-send:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

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

/* =========================================================
   DELIVERABLES VIEWER (RIGHT PANEL)
   ========================================================= */
.deliverable-column {
  width: 440px;
  min-width: 440px;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.deliverable-column.hidden {
  display: none;
}

.deliverable-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.deliverable-header {
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.d-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.d-icon {
  font-size: 22px;
}

.d-title-group h3 {
  font-size: 14.5px;
  font-weight: 700;
}

.d-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.d-actions {
  display: flex;
  gap: 6px;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

/* Empty Deliverable State */
.empty-deliverable {
  margin: auto;
  text-align: center;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-art {
  font-size: 40px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.empty-deliverable h4 {
  font-size: 15px;
  font-weight: 700;
}

.empty-deliverable p {
  font-size: 12.5px;
  color: var(--text-secondary);
  max-width: 280px;
  line-height: 1.5;
}

/* Carousel Interactive Viewer */
.carousel-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.carousel-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.format-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.fmt-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.fmt-btn.active {
  background: var(--accent-purple);
  color: #fff;
}

.slide-indicator {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Slide Card Display */
.slide-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

.slide-card {
  width: 100%;
  max-width: 360px;
  border-radius: 16px;
  background: linear-gradient(145deg, #1e1b4b, #0f172a);
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.slide-card.format-1-1 {
  aspect-ratio: 1 / 1;
}

.slide-card.format-4-5 {
  aspect-ratio: 4 / 5;
}

.slide-card.format-9-16 {
  aspect-ratio: 9 / 16;
  max-width: 280px;
}

.slide-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slide-badge {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.slide-brand {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

.slide-card-body {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide-hook {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
}

.slide-points {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.5;
}

.slide-card-footer {
  display: flex;
  justify-content: flex-end;
}

.swipe-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.carousel-nav-arrows {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn-arrow {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-arrow:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.btn-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Call Previewer */
.call-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.call-summary-box, .call-todos-box, .call-drafts-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.call-summary-box h4, .call-todos-box h4, .call-drafts-box h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.call-summary-box p {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  padding: 8px 10px;
  border-radius: 6px;
}

.todo-priority {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.todo-priority.haute { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.todo-priority.moyenne { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.todo-priority.info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

.draft-content {
  font-size: 12.5px;
  color: #cbd5e1;
  background: var(--bg-input);
  padding: 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  margin-bottom: 10px;
  font-family: var(--font-sans);
}

.btn-copy-sm {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================================
   EDITORIAL CALENDAR VIEW
   ========================================================= */
#calendar-view {
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
}

.calendar-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-header-bar h2 {
  font-size: 20px;
  font-weight: 800;
}

.calendar-header-bar p {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.cal-day-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
}

.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cal-day-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.cal-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cal-card:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.cal-tag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cal-platform-pill {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.cal-status-pill {
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.cal-status-pill.planifie { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.cal-status-pill.publie { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.cal-status-pill.brouillon { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.cal-status-pill.deplanifie { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.cal-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.cal-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.cal-card-footer-action {
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent-purple);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cal-card:hover .cal-card-footer-action {
  color: #c4b5fd;
  text-decoration: underline;
}

/* =========================================================
   ARCHITECTURE & PROMPTS VIEW
   ========================================================= */
#prompts-view {
  padding: 24px;
  gap: 20px;
  overflow: hidden;
}

.prompts-header-bar h2 {
  font-size: 20px;
  font-weight: 800;
}

.prompts-header-bar p {
  font-size: 13px;
  color: var(--text-secondary);
}

.prompt-architect-split {
  flex: 1;
  display: flex;
  gap: 20px;
  min-height: 0;
}

.prompt-list-sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.prompt-tab-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.prompt-tab-item:hover {
  background: var(--bg-card-hover);
}

.prompt-tab-item.active {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.15);
}

.prompt-tab-item strong {
  font-size: 13px;
  color: #fff;
}

.prompt-tab-item span {
  font-size: 11px;
  color: var(--text-secondary);
}

.prompt-tab-divider {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-top: 10px;
  padding-left: 4px;
}

.prompt-viewer-pane {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-viewer-header {
  padding: 12px 18px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.prompt-code-block {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
   AGENT EDITING & MODAL STYLES
   ========================================================= */
.section-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-add-agent {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-agent:hover {
  background: var(--accent-purple);
  color: #fff;
  transform: scale(1.03);
}

.model-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-saved-hint {
  font-size: 10px;
  color: var(--accent-emerald);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.model-saved-hint.show {
  opacity: 1;
}

.btn-action-danger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(139, 92, 246, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-in 0.25s ease-out;
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(15px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 16px 22px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-modal-close:hover {
  color: #fff;
}

.modal-form {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-row input[type="color"] {
  width: 42px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-submit {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* =========================================================
   RESPONSIVE DESIGN & MOBILE DRAWER NAVIGATION
   ========================================================= */

/* Mobile Backdrop Overlay */
.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Top Bar (Hidden on desktop) */
.mobile-top-bar {
  display: none;
  height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
}

.btn-mobile-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mobile-toggle:hover {
  background: var(--bg-card);
  border-color: var(--border-active);
}

.mobile-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.mobile-app-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-mobile-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-mobile-agent:hover {
  border-color: var(--accent-purple);
}

.mobile-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Tablet & Mobile Breakpoints (<= 1024px) */
@media (max-width: 1024px) {
  .mobile-top-bar {
    display: flex;
  }

  .btn-close-sidebar {
    display: flex;
  }

  .app-container {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* Transform Sidebar into an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 86vw;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.7);
    border-right: 1px solid var(--border-subtle);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content fills available vertical height */
  .main-content {
    flex: 1;
    height: calc(100vh - 56px);
    overflow: hidden;
  }

  /* Workspace split: stack chat and deliverable vertically */
  .workspace-split {
    flex-direction: column;
    overflow-y: auto;
  }

  .chat-column {
    min-height: 550px;
    flex: 1 0 auto;
  }

  .deliverable-column {
    width: 100%;
    min-width: 100%;
    min-height: 500px;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .agent-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .agent-meta {
    gap: 12px;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-action, .btn-action-ghost {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .calendar-days-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

/* Smartphone Breakpoints (<= 640px) */
@media (max-width: 640px) {
  .messages-container {
    padding: 14px 12px;
    gap: 14px;
  }

  .message-bubble {
    max-width: 96%;
  }

  .msg-body {
    padding: 10px 14px;
    font-size: 13.5px;
  }

  .agent-header {
    padding: 10px 12px;
  }

  .header-avatar {
    width: 40px;
    height: 40px;
  }

  .agent-title-row h1 {
    font-size: 15px;
  }

  .agent-desc {
    display: none;
  }

  .quick-prompts-bar {
    padding: 8px 12px;
  }

  .chat-input-wrapper {
    padding: 10px 12px;
  }

  .chat-form {
    padding: 10px 12px;
  }

  .chat-form textarea {
    font-size: 13.5px;
  }

  .calendar-days-grid {
    grid-template-columns: 1fr;
  }

  .modal-card {
    width: 95vw;
    max-height: 90vh;
    padding: 16px;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .welcome-roles-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   LOGIN SCREEN & AUTHENTICATION UI
   ========================================================= */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 50% 25%, rgba(139, 92, 246, 0.18) 0%, rgba(6, 182, 212, 0.06) 40%, #060911 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px;
}

.login-card {
  width: 420px;
  max-width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(139, 92, 246, 0.2);
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.login-logo-icon {
  font-size: 32px;
  margin-bottom: 2px;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.6));
}

.login-header h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  letter-spacing: 0.3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-login-submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.45);
}

.btn-login-submit:active {
  transform: translateY(0);
}

.login-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.login-hint strong {
  color: #cbd5e1;
}

.login-hint-sub {
  color: #64748b;
  font-size: 10.5px;
}

/* User Auth Box in Sidebar */
.user-auth-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-role-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.user-name-text {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-auth-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-action:hover {
  background: var(--accent-purple);
  color: #fff;
}

.btn-auth-action-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth-action-ghost:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

