/* Evotion Studios Client Content Dashboard Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #000000;
  --bg-secondary: #0d0d0d;
  --bg-card: rgba(15, 15, 15, 0.65);
  --bg-card-hover: rgba(25, 25, 25, 0.8);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-glow: rgba(210, 31, 4, 0.25);
  
  /* Brand Theme Colors */
  --brand-color: #D21f04;
  --brand-gradient: linear-gradient(135deg, #D21f04 0%, #e8451e 100%);
  --brand-glow: rgba(210, 31, 4, 0.35);
  
  /* Utility Colors */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Scrollbar Width */
  --sb-size: 6px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(210, 31, 4, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: var(--sb-size);
  height: var(--sb-size);
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brand-color);
}

/* Glassmorphic Container */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* main application grid */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  height: 100%;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.brand-section {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--brand-glow);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(to right, #fff, #b3b3b3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  color: var(--brand-color);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: -2px;
}

/* Client Selector Section */
.clients-section {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 8px;
  font-weight: 700;
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  height: 56px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  color: var(--text-secondary);
  position: relative;
  flex-shrink: 0;
}

.client-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.client-item:hover .client-three-dot { opacity: 1; }

.client-item.active {
  background: rgba(210, 31, 4, 0.08);
  border-color: var(--border-color-glow);
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: inset 0 0 8px rgba(210, 31, 4, 0.05);
}

.client-item.active::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--brand-color);
  border-radius: 4px;
  margin-left: -12px;
  position: absolute;
}

.client-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.client-meta span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-niche {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Three-dot menu button */
.client-three-dot {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  transition: var(--transition-fast);
  flex-shrink: 0;
  letter-spacing: 1px;
}
.client-three-dot:hover { color: var(--text-primary); background: rgba(255,255,255,0.07); }
.client-item.menu-open .client-three-dot { opacity: 1; color: var(--brand-color); }

/* Client dropdown menu */
.client-dropdown {
  display: none;
  position: absolute;
  right: 8px;
  top: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-glow);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 50;
  min-width: 130px;
  overflow: hidden;
}
.client-item.menu-open .client-dropdown { display: block; }
.client-dropdown-item {
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.client-dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.client-dropdown-item[data-action="edit"] { background: var(--brand-color); color: #ffffff; }
.client-dropdown-item[data-action="edit"]:hover { background: #e8451e; color: #ffffff; }

.btn-add-client {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition-fast);
  margin-top: auto;
  margin-bottom: 8px;
}

.btn-add-client:hover {
  border-color: var(--brand-color);
  color: var(--brand-color);
  background: rgba(210, 31, 4, 0.02);
}

/* Sidebar Footer / Settings Toggle */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.4);
}

.footer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.footer-nav-item:hover, .footer-nav-item.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.footer-nav-item.active {
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Main Content Layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Top bar navigation style header */
.header-bar {
  height: 70px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  flex-shrink: 0;
}

.active-client-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px var(--brand-glow);
}

.client-title-group h2 {
  font-size: 1.15rem;
  color: var(--text-primary);
}

.client-title-group p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tab-nav {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--brand-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.02);
}

/* Panel Containers */
.panel-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  display: none;
}

.panel-container.active {
  display: block;
}

/* 1. Client Overview Panel */
.overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.card {
  padding: 24px;
  margin-bottom: 24px;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.meta-item {
  background: rgba(0, 0, 0, 0.15);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 4px;
}

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

.funnel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
}

.funnel-status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.funnel-status-badge.active {
  background: var(--success-glow);
  color: var(--success);
}

.funnel-status-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-tag {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-color);
}

/* 2. AI Agent Studio Panel */
.studio-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.suite-selector {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.suite-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.suite-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.suite-btn.active {
  background: var(--brand-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 15px var(--brand-glow);
}

.suite-btn--featured {
  border-color: var(--brand-color, #7c3aed);
  color: var(--brand-color, #7c3aed);
  position: relative;
}

.suite-btn--featured:not(.active)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--brand-gradient);
  opacity: 0.08;
  pointer-events: none;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.agent-card {
  padding: 16px 18px;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 130px;
}

.agent-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: var(--border-color-glow);
  box-shadow: 0 8px 24px rgba(210, 31, 4, 0.08);
}

/* Priority agents — monthly cycle cards (Trend Research, Analytics Intake, Content Calendar) */
.agent-card--priority {
  border: 1.2px solid var(--brand-color);
  box-shadow: 0 4px 20px rgba(210, 31, 4, 0.12), inset 0 0 0 1px rgba(210, 31, 4, 0.06);
}

.agent-card--priority:hover {
  border-color: #ffffff;
  box-shadow: 0 8px 28px rgba(210, 31, 4, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
}

.agent-card h4 {
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.agent-card p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-footer {
  font-size: 0.72rem;
  color: var(--brand-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Agent category section headers */
.agents-section {
  display: contents;
}
.agents-section-header {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 2px 4px;
  border-bottom: 1px solid var(--border-color);
  margin-top: 4px;
}
.agents-section-header:first-child { margin-top: 0; }

/* Content Machine — step headers get elevated treatment */
.suite-content-machine .agents-section-header {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 12px 4px 6px;
  margin-top: 16px;
  border-bottom-color: rgba(124, 58, 237, 0.25);
}

/* Agent Workspace (Console Mode) */
.agent-console-view {
  display: none; /* Toggled via class */
  grid-template-columns: 360px 1fr;
  gap: 24px;
  height: 100%;
}

.agent-console-view.active {
  display: grid;
}

.console-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding: 20px 16px 20px 20px;
}

.console-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  align-self: flex-start;
  transition: var(--transition-fast);
}

.console-back-btn:hover {
  color: var(--brand-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
  padding: 14px 18px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: var(--transition-fast);
}

/* Auto-expanding textareas — grow with content instead of scrolling internally */
.form-group textarea,
#client-modal textarea {
  resize: none;
  overflow: hidden;
  min-height: 90px;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--brand-color);
  box-shadow: 0 0 8px var(--brand-glow);
}

/* Platform connection validation states */
.form-group input.field-valid {
  border-color: var(--success) !important;
  background: rgba(16,185,129,0.08) !important;
  box-shadow: 0 0 0 1px rgba(16,185,129,0.25);
}
.form-group input.field-invalid {
  border-color: var(--danger) !important;
  background: rgba(239,68,68,0.08) !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.25);
}
.form-group input.field-checking {
  border-color: var(--warning) !important;
  opacity: 0.7;
}
.form-group input.field-unknown {
  border-color: var(--text-muted) !important;
  box-shadow: 0 0 0 1px rgba(107,114,128,0.25);
}

.btn-generate {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--brand-glow);
}

.btn-generate:hover {
  box-shadow: 0 4px 20px rgba(210, 31, 4, 0.5);
  transform: translateY(-1px);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Console Workspace Output Panel */
.console-output-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.output-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.action-btn-icon {
  padding: 8px 10px;
}

.action-dropdown {
  position: relative;
}

.action-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
}

.action-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface-2, #1a1a2e);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
  min-width: 160px;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.action-dropdown-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

.action-btn {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.action-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.action-btn.primary {
  background: rgba(210, 31, 4, 0.08);
  border-color: var(--border-color-glow);
  color: var(--brand-color);
}

.action-btn.primary:hover {
  background: rgba(210, 31, 4, 0.15);
  color: #e8451e;
}

.output-content-wrapper {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  overflow-y: auto;
  position: relative;
}

.terminal-style {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.terminal-style h1, .terminal-style h2, .terminal-style h3 {
  color: var(--brand-color);
  margin-top: 20px;
  margin-bottom: 10px;
}

.terminal-style h1:first-child, .terminal-style h2:first-child {
  margin-top: 0;
}

.terminal-style p {
  margin-bottom: 14px;
}

.terminal-style ul, .terminal-style ol {
  margin-left: 20px;
  margin-bottom: 14px;
}

.terminal-style li {
  margin-bottom: 6px;
}

.terminal-style code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #e8451e;
}

.terminal-style pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.terminal-style pre code {
  color: var(--text-primary);
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
}

.console-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 40px;
}

.console-welcome-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.95;
    filter: drop-shadow(0 0 10px var(--brand-color));
  }
}

.generating-indicator {
  display: none; /* Toggled in JS */
  align-items: center;
  gap: 12px;
  color: var(--brand-color);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(210, 31, 4, 0.1);
  border-top-color: var(--brand-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 3. Asset Library Panel */
.library-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.library-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.search-wrapper {
  position: relative;
  width: 320px;
}

.search-input {
  width: 100%;
  padding: 10px 16px;
  padding-left: 36px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-color);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Library type filter chips ─────────────────────────────────────── */
.library-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -8px; /* pull up slightly below library-controls */
}

.library-type-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  text-transform: capitalize;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.library-type-chip:hover {
  border-color: var(--brand-color);
  color: var(--brand-color);
}

.library-type-chip.active {
  background: var(--brand-color);
  border-color: var(--brand-color);
  color: #fff;
  font-weight: 600;
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.asset-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 220px;
}

.asset-badge {
  align-self: flex-start;
  padding: 4px 8px;
  background: rgba(210, 31, 4, 0.08);
  border: 1px solid var(--border-color-glow);
  color: var(--brand-color);
  font-size: 0.7rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
}

.asset-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  margin-bottom: 12px;
}

.asset-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.asset-actions {
  display: flex;
  gap: 8px;
}

.asset-action-icon {
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  padding: 4px;
}

.asset-action-icon:hover {
  color: var(--brand-color);
}

.asset-action-icon.delete:hover {
  color: var(--danger);
}

/* 4. Settings Panel */
.settings-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}

.settings-box {
  padding: 24px;
}

.settings-box h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.api-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-top: 8px;
}

.api-key-status.active {
  color: var(--success);
}

.api-key-status.inactive {
  color: var(--warning);
}

.api-badge-active {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 20px;
  padding: 2px 10px;
}

.api-badge-inactive {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148,163,184,0.08);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 20px;
  padding: 2px 10px;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
}

.branding-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.branding-color-swatch {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background-color: var(--brand-color);
  box-shadow: 0 0 10px var(--brand-glow);
}

/* Add/Edit Client Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  width: 820px;
  max-width: 94vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 36px;
  animation: modal-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background: #161616;
  border: 1px solid var(--border-color-glow);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 48px rgba(210, 31, 4, 0.1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -36px -36px 24px;
  padding: 18px 36px;
  position: sticky;
  top: -36px;
  z-index: 20;
  background: #1c1c1c;
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--brand-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 10px var(--brand-glow);
}

.btn-primary:hover {
  box-shadow: 0 4px 15px rgba(210, 31, 4, 0.4);
}

/* ─── CONSOLE SCRIPT BROWSER (embedded in REI agent sidebar) ─── */

.console-script-browser {
  margin: 12px 0;
  border: 1px solid var(--border-color-glow);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(210, 31, 4, 0.04);
}

/* Header bar */
.csb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(210, 31, 4, 0.08);
  border-bottom: 1px solid var(--border-color-glow);
  cursor: default;
}

.csb-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-color);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.csb-count {
  font-size: 0.68rem;
  background: rgba(210,31,4,0.15);
  border: 1px solid rgba(210,31,4,0.3);
  border-radius: 10px;
  padding: 1px 7px;
  color: var(--brand-color);
  font-weight: 600;
}

.csb-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}
.csb-toggle:hover { color: var(--brand-color); }

/* Body */
.csb-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

/* Controls row: search + bundle select */
.csb-controls {
  display: flex;
  gap: 6px;
}

.csb-search {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 5px 10px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.csb-search::placeholder { color: var(--text-muted); }
.csb-search:focus { border-color: var(--border-color-glow); }

.csb-bundle-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 5px 6px;
  cursor: pointer;
  outline: none;
  max-width: 110px;
}

/* Script list */
.console-script-list {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(210,31,4,0.3) transparent;
}

.console-script-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 5px;
  transition: background var(--transition-fast);
  cursor: default;
}
.console-script-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Compact bundle color pill */
.csi-badge {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
}

/* Reuse bundle colors */
.bundle-1 { background: rgba(210,31,4,0.15);  color: #e8451e; border: 1px solid rgba(210,31,4,0.25); }
.bundle-2 { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.bundle-3 { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.bundle-4 { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }
.bundle-5 { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.bundle-6 { background: rgba(20,184,166,0.15); color: #2dd4bf; border: 1px solid rgba(20,184,166,0.25); }

.csi-num {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 28px;
}

.csi-title {
  flex: 1;
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.csi-load-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 5px;
  transition: all var(--transition-fast);
  opacity: 0;
}
.console-script-item:hover .csi-load-btn {
  opacity: 1;
  border-color: var(--border-color-glow);
  color: var(--brand-color);
}

.console-script-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 8px;
}

/* Batch rewrite button */
.csb-batch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px;
  background: rgba(210,31,4,0.07);
  border: 1px dashed rgba(210,31,4,0.35);
  border-radius: 6px;
  color: var(--brand-color);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.csb-batch-btn:hover {
  background: rgba(210,31,4,0.14);
  border-style: solid;
}

/* File input styling — override browser defaults */
input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

input[type="file"]:hover {
  border-color: var(--border-color-glow);
  color: var(--text-primary);
}

input[type="file"]::file-selector-button {
  background: rgba(210, 31, 4, 0.1);
  border: 1px solid var(--border-color-glow);
  border-radius: 5px;
  color: var(--brand-color);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
  background: rgba(210, 31, 4, 0.2);
}

/* Document File Upload Preview */
.doc-upload-preview {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(210, 31, 4, 0.07);
  border: 1px solid var(--border-color-glow);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 100%;
}

.doc-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.doc-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.doc-chip-remove:hover {
  color: var(--danger);
}

/* Model Selector Buttons */
.model-selector-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.model-selector-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.model-selector-btn:hover {
  border-color: var(--border-color-glow);
  color: var(--text-primary);
}

.model-selector-btn.active {
  border-color: var(--brand-color);
  background: rgba(210, 31, 4, 0.08);
  color: var(--brand-color);
  box-shadow: 0 0 12px var(--brand-glow);
}

/* Edit Asset Modal */
.edit-asset-modal-content {
  width: 800px;
  max-width: 95vw;
}

/* Notification banner */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #000000;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand-color);
  padding: 16px 24px;
  border-radius: 8px;
  color: var(--text-primary);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast-notification.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Custom Markdown formatting overrides for output content */
.markdown-body {
  font-size: 0.95rem;
  line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.markdown-body h1 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}
.markdown-body h2 {
  font-size: 1.25rem;
}
.markdown-body h3 {
  font-size: 1.1rem;
}
.markdown-body p {
  margin-bottom: 16px;
}
.markdown-body ul, .markdown-body ol {
  margin-bottom: 16px;
  padding-left: 20px;
}
.markdown-body li {
  margin-bottom: 6px;
}
.markdown-body blockquote {
  border-left: 4px solid var(--brand-color);
  padding-left: 16px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 16px 0;
}
.markdown-body hr {
  height: 1px;
  border: none;
  background: var(--border-color);
  margin: 24px 0;
}

/* Custom Visual JSON Renderer / Thumbnail Dashboard Styles */
.visual-json-dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.visual-dashboard-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.vd-tab-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.vd-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.vd-tab-btn.active {
  background: rgba(210, 31, 4, 0.1);
  border-color: var(--brand-color);
  color: var(--brand-color);
}

.vd-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.vd-panel.active {
  display: block;
}

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

/* Style Extraction & Insights Panel */
.insights-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.insight-block {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
}

.insight-block h4 {
  font-size: 0.95rem;
  color: var(--brand-color);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.insight-item {
  font-size: 0.82rem;
  line-height: 1.4;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
  padding-bottom: 8px;
}

.insight-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.insight-label {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.color-tag-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.color-tag {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch-circle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Concepts Interactive Section */
.concepts-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  min-height: 450px;
}

.concepts-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--border-color);
  padding-right: 12px;
}

.concept-nav-item {
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.concept-nav-item:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.concept-nav-item.active {
  background: rgba(210, 31, 4, 0.08);
  border-color: var(--border-color-glow);
  color: var(--brand-color);
  font-weight: 600;
}

.concept-workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.concept-meta-strip {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.1);
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.aspect-ratio-toggle-box {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.3);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  align-self: center;
}

.ratio-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.ratio-btn.active {
  background: var(--brand-gradient);
  color: white;
}

/* Visual aspect ratio preview cards */
.thumbnail-preview-workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: flex-start;
}

.preview-ratio-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ratio-frame-outer {
  background: #0f131f;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: border-color var(--transition-normal);
}

.ratio-frame-outer:hover {
  border-color: var(--brand-color);
}

/* Aspect ratio frames */
.frame-vertical {
  width: 200px;
  height: 356px; /* 9:16 aspect ratio */
}

.frame-horizontal {
  width: 320px;
  height: 180px; /* 16:9 aspect ratio */
}

.mock-thumbnail-content {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  box-sizing: border-box;
}

.mock-bg-mesh {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.35;
  background-size: cover;
  background-position: center;
}

.mock-person-avatar {
  position: absolute;
  bottom: 0;
  z-index: 2;
  width: 75%;
  height: 85%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom right;
}

/* Center person for vertical if styled */
.frame-vertical .mock-person-avatar {
  width: 80%;
  height: 70%;
  right: 0%;
}

.frame-horizontal .mock-person-avatar {
  right: 5%;
  width: 50%;
  height: 90%;
}

.mock-headline-overlay {
  position: relative;
  z-index: 3;
  width: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 4px 10px rgba(0,0,0,0.9);
  word-wrap: break-word;
}

.frame-vertical .mock-headline-overlay {
  font-size: 1.2rem;
  max-width: 100%;
  text-align: left;
}

.frame-horizontal .mock-headline-overlay {
  font-size: 1.4rem;
  max-width: 60%;
  text-align: left;
}

.concept-details-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.concept-detail-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.concept-detail-card h5 {
  font-size: 0.85rem;
  color: var(--brand-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prompt-copy-block {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 8px;
  overflow: hidden;
}

.prompt-copy-text {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 10px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.prompt-copy-btn {
  background: rgba(210, 31, 4, 0.08);
  border: none;
  border-left: 1px solid var(--border-color);
  color: var(--brand-color);
  padding: 0 12px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.prompt-copy-btn:hover {
  background: var(--brand-gradient);
  color: white;
}

/* Designer Handoff Panel */
.handoff-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.recommendation-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.rec-badge-icon {
  font-size: 2rem;
  color: var(--success);
}

.designer-notes-block {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-secondary);
}


/* ─── AGENT RUN HISTORY ─────────────────────────────────────────────────── */

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.history-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.history-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
}
.history-toggle-btn:hover { color: var(--text-primary); }
.history-toggle-btn.active { background: var(--bg-card); color: var(--brand-color); }

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

.history-list-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.history-list-row:hover { border-color: var(--border-color-glow); background: var(--bg-card-hover); }
.history-list-label { flex: 1; font-weight: 600; font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-list-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.history-list-preview { font-size: 0.78rem; color: var(--text-secondary); flex: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.history-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.history-board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-board-card:hover { transform: translateY(-3px); border-color: var(--border-color-glow); box-shadow: 0 8px 24px rgba(210,31,4,0.08); }
.history-card-label { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.history-card-date { font-size: 0.72rem; color: var(--brand-color); font-weight: 600; }
.history-card-preview { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.history-card-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 10px; margin-top: auto; }
.history-delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition-fast); display: flex; align-items: center; }
.history-delete-btn:hover { color: var(--danger); }
.history-rerun-btn { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); cursor: pointer; padding: 3px 10px; border-radius: 5px; font-size: 0.72rem; font-weight: 600; transition: var(--transition-fast); white-space: nowrap; }
.history-rerun-btn:hover { border-color: var(--brand-color); color: var(--brand-color); background: rgba(210,31,4,0.06); }
.history-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 0.9rem; }

.history-result-view { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.history-result-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.history-result-content { flex: 1; overflow-y: auto; background: rgba(0,0,0,0.15); border: 1px solid var(--border-color); border-radius: 10px; padding: 24px; }

/* ============================================================
   AUTO-INTAKE — URL Analysis Section
   ============================================================ */
.intake-url-section {
  background: rgba(210, 31, 4, 0.05);
  border: 1px solid rgba(210, 31, 4, 0.18);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.intake-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.intake-section-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.intake-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(210,31,4,0.15);
  color: var(--brand-color);
  letter-spacing: 0.04em;
}
.intake-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}
.intake-url-row:last-of-type { margin-bottom: 0; }
.intake-url-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 68px;
  text-align: right;
  flex-shrink: 0;
}
.intake-url-row input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 7px 11px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}
.intake-url-row input:focus { border-color: rgba(210,31,4,0.4); }
.btn-analyze {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.btn-analyze:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-analyze:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.intake-status {
  margin-top: 8px;
  font-size: 0.77rem;
  padding: 6px 10px;
  border-radius: 6px;
  display: none;
  align-items: center;
  gap: 7px;
  line-height: 1.4;
}
.intake-status.loading  { display: flex; color: var(--brand-color);  background: rgba(210,31,4,0.06); border: 1px solid rgba(210,31,4,0.14); }
.intake-status.success  { display: flex; color: var(--success);       background: rgba(16,185,129,0.06); border: 1px solid rgba(16,185,129,0.18); }
.intake-status.error    { display: flex; color: #ef4444;              background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.18); }
.intake-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.intake-divider::before, .intake-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

/* Confidence indicators on form-group labels & inputs */
.form-group .confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 7px;
  margin-left: 6px;
  vertical-align: middle;
  cursor: default;
}
.confidence-badge.medium {
  background: rgba(245,158,11,0.14);
  color: #f59e0b;
}
.confidence-badge.low {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}
/* !important needed here so the confidence border color survives
   higher-specificity :focus rules (e.g. #client-modal input:focus)
   while the user is actively editing a flagged field. If badge/border
   styling is reworked later, fold this into a single rule with the
   focus selectors instead of overriding via !important. */
.form-group.confidence-medium input,
.form-group.confidence-medium textarea {
  border-color: rgba(245,158,11,0.45) !important;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.07);
}
.form-group.confidence-low input,
.form-group.confidence-low textarea {
  border-color: rgba(239,68,68,0.45) !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.07);
}

/* Content Pillars — tag display in overview */
.pillars-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.pillar-tag {
  background: rgba(210,31,4,0.1);
  color: var(--brand-color);
  border: 1px solid rgba(210,31,4,0.22);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.73rem;
  font-weight: 600;
}
.meta-value.gaps-text {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* Re-sync button stub — V2 placeholder */
.btn-resync-stub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-color);
  padding: 3px 9px;
  border-radius: 6px;
  cursor: not-allowed;
  opacity: 0.55;
  flex-shrink: 0;
}

/* ============================================================
   V2 RE-SYNC — Diff Modal & Related
   ============================================================ */

/* Last-synced badge under Re-sync button */
.resync-last-synced {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Re-sync button — active state (replaces stub) */
.btn-resync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.btn-resync:hover {
  border-color: var(--brand-color);
  color: var(--brand-color);
}
.btn-resync:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border-color);
  color: var(--text-muted);
}
.btn-resync.spinning svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Diff Modal */
.diff-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.diff-modal-overlay.active {
  display: flex;
  opacity: 1;
}
.diff-modal {
  width: 680px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color-glow);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: modal-slide-in 0.3s cubic-bezier(0.16,1,0.3,1);
}
.diff-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.diff-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-color);
  margin: 0 0 4px;
}
.diff-modal-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}
.diff-modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 16px;
}
.diff-modal-close:hover { color: var(--brand-color); }

/* Individual diff row */
.diff-row {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.diff-row.accepted { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.04); }
.diff-row.rejected { opacity: 0.45; }
.diff-field-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.diff-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.diff-col-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.03em;
}
.diff-old {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: line-through;
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.12);
  border-radius: 6px;
  white-space: pre-wrap;
}
.diff-new {
  font-size: 0.82rem;
  color: #6ee7b7;
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.18);
  border-radius: 6px;
  white-space: pre-wrap;
}
.diff-edit-field {
  width: 100%;
  font-size: 0.82rem;
  color: #6ee7b7;
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 6px;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  transition: border-color 0.15s;
}
.diff-edit-field:focus {
  outline: none;
  border-color: rgba(16,185,129,0.5);
  background: rgba(16,185,129,0.1);
}
.diff-row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}
.btn-accept-field {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.1);
  color: #6ee7b7;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-accept-field:hover { background: rgba(16,185,129,0.2); }
.btn-reject-field {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(239,68,68,0.2);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-reject-field:hover { color: #ef4444; border-color: rgba(239,68,68,0.4); }

/* No-changes state */
.diff-no-changes {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.diff-no-changes svg { margin-bottom: 12px; opacity: 0.4; }
.diff-no-changes p { font-size: 0.85rem; }

/* Diff modal footer */
.diff-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  gap: 10px;
}
.diff-change-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.diff-footer-actions {
  display: flex;
  gap: 8px;
}
.btn-accept-all {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-accept-all:hover { opacity: 0.88; }
.btn-dismiss-diff {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-dismiss-diff:hover { border-color: rgba(255,255,255,0.15); color: var(--text-primary); }

/* Confidence badge inside diff new value */
.diff-confidence {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.diff-confidence.medium { background: rgba(245,158,11,0.14); color: #f59e0b; }
.diff-confidence.low    { background: rgba(239,68,68,0.12);  color: #ef4444; }

/* ============================================================
   TRANSCRIPT HUB
   ============================================================ */
.transcript-hub-panel {
  background: rgba(210,31,4,0.03);
  border: 1px solid rgba(210,31,4,0.18);
  border-left: 3px solid var(--brand-color);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(210,31,4,0.1);
  background: rgba(210,31,4,0.04);
}
.hub-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--text-primary);
}
.hub-title-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(210,31,4,0.14);
  color: var(--brand-color);
  border-radius: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hub-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}
.btn-new-episode {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 13px;
  background: var(--brand-gradient);
  border: none;
  color: white;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-new-episode:hover { opacity: 0.87; }
.hub-episodes-list {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hub-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Episode card */
.episode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.episode-card.expanded { border-color: rgba(210,31,4,0.28); }
.episode-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.episode-card-row:hover { background: var(--bg-card-hover); }
.episode-num {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--brand-color);
  min-width: 34px;
  background: rgba(210,31,4,0.1);
  border-radius: 5px;
  padding: 3px 5px;
  text-align: center;
  flex-shrink: 0;
}
.episode-card-meta { flex: 1; min-width: 0; }
.episode-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-card-sub {
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-status-badge {
  font-size: 0.63rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.episode-status-badge.pre-production { background: rgba(107,114,128,0.14); color: #9ca3af; }
.episode-status-badge.recorded       { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.episode-status-badge.in-edit        { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.episode-status-badge.published      { background: rgba(16,185,129,0.12);  color: #10b981; }
.episode-transcript-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.episode-transcript-dot.has-transcript { background: var(--success); box-shadow: 0 0 4px rgba(16,185,129,0.4); }
.episode-transcript-dot.no-transcript  { background: transparent; border: 1px solid var(--text-muted); }
.episode-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ep-action-btn {
  background: transparent;
  border: none;
  padding: 4px 5px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 5px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
}
.ep-action-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.ep-action-btn.delete:hover { color: var(--danger); }
.episode-expand-icon { color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s; }
.episode-card.expanded .episode-expand-icon { transform: rotate(180deg); }

/* Episode expanded body */
.episode-body {
  border-top: 1px solid var(--border-color);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.episode-body-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.episode-transcript-area {
  width: 100%;
  min-height: 110px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}
.episode-transcript-area:focus { outline: none; border-color: var(--brand-color); }
.transcript-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.btn-transcript-upload {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-transcript-upload:hover { border-color: rgba(255,255,255,0.18); color: var(--text-primary); }
.transcript-file-label { font-size: 0.7rem; color: var(--text-muted); }

/* Agent selector */
.agent-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.btn-select-all-agents {
  font-size: 0.71rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--brand-color);
  cursor: pointer;
  padding: 0;
}
.btn-select-all-agents:hover { text-decoration: underline; }
.agent-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.agent-selector-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}
.agent-selector-item:hover { border-color: rgba(255,255,255,0.1); }
.agent-selector-item.selected { background: rgba(210,31,4,0.08); border-color: rgba(210,31,4,0.28); }
.agent-selector-item input[type="checkbox"] { accent-color: var(--brand-color); width: 13px; height: 13px; flex-shrink: 0; pointer-events: none; }
.agent-sel-icon { font-size: 0.95rem; flex-shrink: 0; }
.agent-sel-name { font-size: 0.76rem; font-weight: 600; color: var(--text-primary); }

/* Hub run footer */
.hub-run-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 4px;
  border-top: 1px solid var(--border-color);
}
.hub-host-input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.hub-host-input:focus { border-color: var(--brand-color); }
.hub-host-input::placeholder { color: var(--text-muted); }
.btn-run-batch {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--brand-gradient);
  border: none;
  color: white;
  border-radius: 8px;
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.btn-run-batch:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-run-batch:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ============================================================
   BATCH REVIEW MODAL
   ============================================================ */
.batch-review-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.84);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.batch-review-overlay.active { display: flex; }
.batch-review-modal {
  width: 920px;
  max-width: 96vw;
  height: 89vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color-glow);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0,0,0,0.75);
  overflow: hidden;
  animation: modal-slide-in 0.28s cubic-bezier(0.16,1,0.3,1);
}
.batch-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.batch-review-header h3 { font-size: 1rem; font-weight: 700; color: var(--brand-color); margin: 0; }
.batch-review-header p { font-size: 0.74rem; color: var(--text-muted); margin: 2px 0 0; }
.batch-review-close { background: none; border: none; color: var(--text-secondary); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0 0 0 12px; }
.batch-review-close:hover { color: var(--brand-color); }
.batch-review-tabs {
  display: flex;
  gap: 3px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
  background: rgba(0,0,0,0.1);
}
.batch-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  color: var(--text-muted);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  position: relative;
  bottom: -1px;
  font-family: inherit;
}
.batch-tab-btn:hover { color: var(--text-primary); }
.batch-tab-btn.active { background: var(--bg-card); border-color: var(--border-color); border-bottom-color: var(--bg-card); color: var(--text-primary); }
.batch-tab-status {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.batch-tab-status.pending { background: rgba(255,255,255,0.15); }
.batch-tab-status.loading { background: var(--brand-color); animation: pulse-dot 0.9s infinite; }
.batch-tab-status.done    { background: var(--success); }
.batch-tab-status.error   { background: var(--danger); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.25} }
.batch-review-body { flex: 1; overflow-y: auto; padding: 24px; }
.batch-tab-content { display: none; }
.batch-tab-content.active { display: block; }
.batch-result-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 220px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.84rem;
}
.batch-result-pending .spinner { width: 26px; height: 26px; border-width: 3px; }
.batch-result-error {
  padding: 18px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 8px;
  color: #ef4444;
  font-size: 0.84rem;
  line-height: 1.5;
}
.batch-review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 10px;
  background: rgba(0,0,0,0.1);
}
.batch-footer-left { font-size: 0.77rem; color: var(--text-muted); }
.batch-footer-actions { display: flex; gap: 8px; }
.btn-save-current-batch {
  font-size: 0.79rem;
  font-weight: 600;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-save-current-batch:hover { border-color: rgba(255,255,255,0.14); color: var(--text-primary); }
.btn-save-all-batch {
  font-size: 0.79rem;
  font-weight: 700;
  padding: 8px 18px;
  background: var(--brand-gradient);
  border: none;
  color: white;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-save-all-batch:hover { opacity: 0.88; }
.btn-save-all-batch:disabled { opacity: 0.42; cursor: not-allowed; }

/* ============================================================
   TRANSCRIPT HUB — Import row & Transcriber Picker
   ============================================================ */
.transcript-import-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.btn-pull-transcriber {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid rgba(210,31,4,0.3);
  color: var(--brand-color);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-pull-transcriber:hover {
  background: rgba(210,31,4,0.07);
  border-color: var(--brand-color);
}
.btn-pull-transcriber.active {
  background: rgba(210,31,4,0.1);
  border-color: var(--brand-color);
}

/* Inline picker dropdown */
.transcriber-picker {
  display: none;
  flex-direction: column;
  margin-top: 6px;
  background: var(--bg-secondary);
  border: 1px solid rgba(210,31,4,0.2);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}
.transcriber-picker.open { display: flex; }
.transcriber-picker-empty {
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.transcriber-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  gap: 10px;
}
.transcriber-picker-item:last-child { border-bottom: none; }
.transcriber-picker-item:hover { background: rgba(210,31,4,0.06); }
.transcriber-picker-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.transcriber-picker-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.transcriber-picker-use {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-color);
  flex-shrink: 0;
}

/* Hub header — pull-from-transcriber button */
.btn-hub-pull {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 13px;
  background: transparent;
  border: 1px solid rgba(210,31,4,0.35);
  color: var(--brand-color);
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-hub-pull:hover { background: rgba(210,31,4,0.08); }
.btn-hub-pull.active { background: rgba(210,31,4,0.12); border-color: var(--brand-color); }

/* Hub-level transcriber picker (below header) */
.hub-transcriber-picker {
  display: none;
  flex-direction: column;
  border-top: 1px solid rgba(210,31,4,0.12);
  background: rgba(210,31,4,0.02);
}
.hub-transcriber-picker.open { display: flex; }
.hub-picker-label {
  padding: 8px 18px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Sidebar logo image */
.brand-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}
.sidebar-logo-img {
  max-height: 38px;
  max-width: 200px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ============================================================
   AGENT PRESETS
   ============================================================ */
.preset-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.btn-preset-save {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-preset-save:hover { border-color: var(--brand-color); color: var(--brand-color); }
.btn-preset-clear {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.25);
  color: rgba(239,68,68,0.7);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-preset-clear:hover { border-color: #ef4444; color: #ef4444; }
.preset-active-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.preset-active-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
/* Dot on agent cards that have saved presets */
.agent-preset-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-color);
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ============================================================
   PODCAST PREP → EPISODE PACKAGE LINK PANEL
   ============================================================ */
.pp-link-panel {
  background: rgba(210,31,4,0.04);
  border: 1px solid rgba(210,31,4,0.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.82rem;
}
.pp-link-panel.linked {
  background: rgba(16,185,129,0.05);
  border-color: rgba(16,185,129,0.25);
}
.pp-link-header {
  display: flex;
  align-items: center;
  gap: 9px;
}
.pp-link-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary);
}
.pp-link-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.pp-link-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pp-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.pp-link-item:hover { border-color: var(--brand-color); background: rgba(210,31,4,0.06); }
.pp-link-item-name {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-link-item-date { font-size: 0.69rem; color: var(--text-muted); flex-shrink: 0; }
.pp-link-item-action {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-color);
  flex-shrink: 0;
}
.pp-unlink-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 8px;
  margin-left: auto;
  transition: color 0.15s;
}
.pp-unlink-btn:hover { color: var(--danger); }

/* ═══════════════════════════════════════════════════════════
   STUDIO SESSION — Tab, Phase Bar, Panels
   ═══════════════════════════════════════════════════════════ */

/* Studio tab button. The !important flags here override the base
   .tab-btn / .tab-btn.active rules (~line 392) which share the same
   specificity (0,2,0) — without !important, source order alone makes
   this win in most cases, but the flags were added as a safety net for
   the active/hover states. If badge/tab styling is normalized later,
   consider a more specific selector (e.g. .tab-btn.studio-session-tab)
   instead of !important. */
.studio-session-tab {
  background: linear-gradient(135deg, rgba(210,31,4,0.15), rgba(210,31,4,0.05));
  border: 1px solid rgba(210,31,4,0.3) !important;
  color: var(--brand-color) !important;
  font-weight: 700;
}
.studio-session-tab.active,
.studio-session-tab:hover {
  background: var(--brand-color) !important;
  color: #fff !important;
  border-color: var(--brand-color) !important;
}

/* Layout wrapper */
.studio-session-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

/* Phase indicator bar */
.ss-phase-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 24px;
}
.ss-phase {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.ss-phase.active  { opacity: 1; }
.ss-phase.done    { opacity: 0.7; }
.ss-phase-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
  transition: all 0.2s;
}
.ss-phase.active .ss-phase-num {
  background: var(--brand-color);
  border-color: var(--brand-color);
  color: #fff;
}
.ss-phase.done .ss-phase-num {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.4);
  color: #22c55e;
}
.ss-phase-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.ss-phase.active .ss-phase-label { color: var(--text-primary); }
.ss-phase-connector {
  flex: 1;
  height: 1px;
  background: var(--border-color);
  margin: 0 16px;
  min-width: 40px;
}

/* Phase panels */
.ss-phase-panel { display: none; }
.ss-phase-panel.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Shared typography */
.ss-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ss-section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── PHASE 1: CAPTURE ───────────────────────────────────── */
.ss-capture-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.ss-capture-controls {
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}
.ss-transcript-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  min-height: 0;
}
.ss-transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ss-transcript-body {
  flex: 1;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
  padding: 4px 0;
}
.ss-transcript-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.5;
}
.ss-transcript-final { color: var(--text-primary); }
.ss-transcript-interim { color: var(--text-muted); font-style: italic; }
.ss-transcript-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}

/* Mic button */
.ss-mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 20px 0 8px;
}
.ss-mic-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: rgba(210,31,4,0.1);
  border: 2px solid rgba(210,31,4,0.3);
  color: var(--brand-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.ss-mic-btn:hover {
  background: rgba(210,31,4,0.18);
  border-color: var(--brand-color);
  transform: scale(1.04);
}
.ss-mic-btn.recording {
  background: var(--brand-color);
  border-color: var(--brand-color);
  color: #fff;
  animation: ss-pulse 1.5s ease-in-out infinite;
}
@keyframes ss-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210,31,4,0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(210,31,4,0); }
}
.ss-mic-btn .ss-mic-label { font-size: 0.65rem; text-align: center; line-height: 1.2; max-width: 70px; }
.ss-mic-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}
.ss-mic-status.live { color: #22c55e; font-weight: 600; }
.ss-mic-status.error { color: var(--danger); }

/* ── PHASE 2: SCRIPT ───────────────────────────────────── */
.ss-script-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.ss-script-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ss-script-generating {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.ss-script-output {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  min-height: 0;
}

/* ── PHASE 3: TELEPROMPTER ─────────────────────────────── */

/* Control bar */
.tp-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  flex-shrink: 0;
}
.tp-controls-left, .tp-controls-right { display: flex; gap: 8px; align-items: center; }
.tp-controls-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: center;
}
.tp-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tp-btn:hover { border-color: var(--brand-color); color: var(--brand-color); }
.tp-btn.active { background: var(--brand-color); border-color: var(--brand-color); color: #fff; }
.tp-play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--brand-color);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
  flex-shrink: 0;
}
.tp-play-btn:hover { transform: scale(1.08); background: #b51903; }
.tp-play-btn.paused { background: rgba(255,255,255,0.15); border: 1px solid var(--border-color); }
.tp-speed-group, .tp-font-group {
  display: flex; align-items: center; gap: 8px;
}
.tp-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.tp-slider {
  -webkit-appearance: none;
  width: 120px; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.tp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand-color);
  cursor: pointer;
}
.tp-speed-val, .tp-font-val {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-primary);
  min-width: 52px;
  white-space: nowrap;
}
.tp-font-btn {
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 32px;
}
.tp-toggle.active { background: rgba(210,31,4,0.2); border-color: var(--brand-color); color: var(--brand-color); }

/* Teleprompter display */
.tp-display {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.06);
}
.tp-display.light-theme { background: #f8f8f8; border-color: rgba(0,0,0,0.1); }
.tp-text-wrapper {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 50% 10% 60%;
  scroll-behavior: auto;
  /* hide scrollbar */
  scrollbar-width: none;
}
.tp-text-wrapper::-webkit-scrollbar { display: none; }
.tp-text {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.45;
  color: #ffffff;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Arial', sans-serif;
  transition: font-size 0.15s;
}
.tp-display.light-theme .tp-text { color: #111111; }
.tp-display.mirrored .tp-text { transform: scaleX(-1); }

/* Focus line — the reading line */
.tp-focus-line {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 2px;
  background: rgba(210,31,4,0.5);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 20px rgba(210,31,4,0.3);
}
/* Fade top and bottom */
.tp-display::before,
.tp-display::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 25%;
  pointer-events: none;
  z-index: 1;
}
.tp-display::before {
  top: 0;
  background: linear-gradient(to bottom, #0a0a0a 0%, transparent 100%);
}
.tp-display::after {
  bottom: 0;
  background: linear-gradient(to top, #0a0a0a 0%, transparent 100%);
}
.tp-display.light-theme::before { background: linear-gradient(to bottom, #f8f8f8 0%, transparent 100%); }
.tp-display.light-theme::after  { background: linear-gradient(to top,   #f8f8f8 0%, transparent 100%); }

/* Progress bar */
.tp-progress-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: var(--brand-color);
  width: 0%;
  transition: width 0.1s linear;
  z-index: 3;
}

/* Fullscreen overrides */
#ss-panel-teleprompter:fullscreen,
#ss-panel-teleprompter:-webkit-full-screen {
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

/* Generate Script button — lives at the bottom of the transcript panel */
.ss-generate-btn-main {
  width: 100%;
  margin-top: 12px;
  padding: 14px 20px;
  background: var(--brand-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ss-generate-btn-main:hover:not(:disabled) { background: #b51903; transform: translateY(-1px); }
.ss-generate-btn-main:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Direct teleprompter paste panel */
.ss-direct-panel {
  padding: 18px 20px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ── Script Editor (Phase 2) ──────────────────────────────── */
.ss-script-editor {
  flex: 1;
  min-height: 300px;
  padding: 20px 24px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}
.ss-script-editor:focus { border-color: var(--brand-color); }

/* ── AI Chat (Phase 2) ────────────────────────────────────── */
.ss-chat-section { flex-shrink: 0; }
.ss-chat-toggle {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
  margin-top: 10px;
}
.ss-chat-toggle:hover { border-color: var(--brand-color); color: var(--brand-color); }
.ss-chat-toggle.open { border-color: var(--brand-color); color: var(--brand-color); background: rgba(210,31,4,0.06); }

.ss-chat-panel {
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 360px;
}
.ss-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  background: rgba(0,0,0,0.15);
}
.ss-chat-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
  text-align: center;
  padding: 8px;
}
.ss-chat-msg { display: flex; flex-direction: column; gap: 4px; }
.ss-chat-msg.user { align-items: flex-end; }
.ss-chat-msg.ai   { align-items: flex-start; }
.ss-chat-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 85%;
}
.ss-chat-msg.user .ss-chat-bubble {
  background: var(--brand-color);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.ss-chat-msg.ai .ss-chat-bubble {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-color);
  white-space: pre-wrap;
}
.ss-chat-apply {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-color);
  background: rgba(210,31,4,0.1);
  border: 1px solid rgba(210,31,4,0.3);
  border-radius: 5px;
  padding: 3px 10px;
  cursor: pointer;
  margin-top: 4px;
  align-self: flex-start;
  transition: all 0.15s;
}
.ss-chat-apply:hover { background: var(--brand-color); color: #fff; }
.ss-chat-thinking {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
  animation: ss-blink 1.2s ease-in-out infinite;
}
@keyframes ss-blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

.ss-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}
.ss-chat-input-row input {
  flex: 1;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.82rem;
}
.ss-chat-input-row input:focus { outline: none; border-color: var(--brand-color); }

/* ── Teleprompter Queue & Navigation ─────────────────────── */
.tp-nav-group {
  display: flex; align-items: center; gap: 4px;
}
.tp-script-counter {
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted);
  min-width: 36px; text-align: center;
  white-space: nowrap;
}
.tp-title-bar {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-align: center;
  padding: 4px 0;
  flex-shrink: 0;
  min-height: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Main area: sidebar + display side by side */
.tp-main-area {
  display: flex;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

/* Queue sidebar */
.tp-queue-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tp-queue-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.tp-queue-list {
  flex: 1; overflow-y: auto; padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.tp-queue-item {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.tp-queue-item:hover { background: rgba(255,255,255,0.06); }
.tp-queue-item.active { background: rgba(210,31,4,0.15); border-color: rgba(210,31,4,0.3); }
.tp-queue-num {
  font-size: 0.7rem; font-weight: 800; color: var(--text-muted);
  min-width: 16px;
}
.tp-queue-item.active .tp-queue-num { color: var(--brand-color); }
.tp-queue-title {
  flex: 1; font-size: 0.75rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.tp-queue-item.active .tp-queue-title { color: var(--text-primary); }
.tp-queue-del {
  opacity: 0; font-size: 0.7rem; color: var(--text-muted); background: none;
  border: none; cursor: pointer; padding: 0 2px; flex-shrink: 0;
}
.tp-queue-item:hover .tp-queue-del { opacity: 1; }
.tp-queue-del:hover { color: var(--danger); }
.tp-queue-add-area {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

/* ── Past Scripts Library ─────────────────────────────────── */
.ss-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.ss-script-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding-bottom: 4px;
  max-height: 340px;
  overflow-y: auto;
}

/* Individual tile */
.ss-script-tile {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.ss-script-tile:hover {
  border-color: var(--brand-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(210,31,4,0.1);
}

/* Delete X — top right */
.ss-tile-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239,68,68,0);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  z-index: 2;
  opacity: 0;
}
.ss-script-tile:hover .ss-tile-delete { opacity: 1; }
.ss-tile-delete:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
  color: #ef4444;
  transform: scale(1.1);
}

/* Tile content */
.ss-tile-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-color);
  background: rgba(210,31,4,0.1);
  border: 1px solid rgba(210,31,4,0.2);
  border-radius: 4px;
  padding: 2px 7px;
  width: fit-content;
  margin-bottom: 2px;
}
.ss-tile-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  padding-right: 20px; /* room for X button */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ss-tile-preview {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ss-tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  gap: 6px;
}
.ss-tile-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.ss-tile-actions {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ss-script-tile:hover .ss-tile-actions { opacity: 1; }
.ss-tile-action-btn {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.ss-tile-action-btn:hover {
  border-color: var(--brand-color);
  color: var(--brand-color);
  background: rgba(210,31,4,0.08);
}
.ss-tile-action-btn.primary-action {
  background: var(--brand-color);
  border-color: var(--brand-color);
  color: #fff;
}
.ss-tile-action-btn.primary-action:hover { background: #b51903; }

/* Empty state */
.ss-library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── RECORD-AUDIO FIELD ─────────────────────────────────── */
.rec-audio-ui { display: flex; flex-direction: column; gap: 8px; }

/* Idle state */
.rec-idle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-rec-start {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(210,31,4,0.1);
  border: 1.5px solid rgba(210,31,4,0.35);
  border-radius: 10px;
  color: var(--brand-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-rec-start:hover {
  background: rgba(210,31,4,0.18);
  border-color: var(--brand-color);
  transform: translateY(-1px);
}
.rec-upload-alt {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.rec-upload-alt:hover { opacity: 1; color: var(--text-secondary); }

/* Active / recording state */
.rec-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(210,31,4,0.08);
  border: 1.5px solid rgba(210,31,4,0.3);
  border-radius: 10px;
  animation: rec-border-pulse 2s ease-in-out infinite;
}
@keyframes rec-border-pulse {
  0%, 100% { border-color: rgba(210,31,4,0.3); }
  50%       { border-color: rgba(210,31,4,0.7); }
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-color);
  flex-shrink: 0;
  animation: rec-dot-blink 1s step-start infinite;
}
@keyframes rec-dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}
.rec-pulse-ring {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(210,31,4,0.4);
  animation: rec-ring 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes rec-ring {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.8); opacity: 0; }
}
.rec-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-color);
  letter-spacing: 0.04em;
  min-width: 38px;
}
.rec-live-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  font-style: italic;
}
.btn-rec-stop {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(210,31,4,0.15);
  border: 1.5px solid var(--brand-color);
  border-radius: 8px;
  color: var(--brand-color);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition-fast);
}
.btn-rec-stop:hover { background: rgba(210,31,4,0.28); }

/* Done state */
.rec-done-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16,185,129,0.08);
  border: 1.5px solid rgba(16,185,129,0.3);
  border-radius: 10px;
  flex-wrap: wrap;
}
.rec-done-chip svg { color: #10b981; flex-shrink: 0; }
.rec-done-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.rec-done-chip audio { height: 28px; flex: 1; min-width: 160px; }
.rec-clear-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: var(--transition-fast);
}
.rec-clear-btn:hover { border-color: var(--brand-color); color: var(--brand-color); }

/* ── COLLAPSIBLE SIDEBAR ────────────────────────────────── */
.sidebar {
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Collapsed: slim strip — toggle button stays visible */
.sidebar.collapsed {
  width: 48px;
}

/* Hide text content when collapsed */
.sidebar.collapsed .clients-section,
.sidebar.collapsed .section-label,
.sidebar.collapsed .btn-add-client,
.sidebar.collapsed .sidebar-text {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Keep brand section visible but shrink it */
.sidebar.collapsed .brand-section {
  padding: 14px 0;
  justify-content: center;
}
.sidebar.collapsed .sidebar-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Footer — center the toggle button when collapsed */
.sidebar.collapsed .sidebar-footer {
  padding: 12px 0;
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar.collapsed #btn-settings-nav {
  justify-content: center;
  padding: 10px;
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  margin-top: 4px;
}
.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

/* Rotate chevron when collapsed */
.sidebar.collapsed .sidebar-toggle-btn #sidebar-toggle-icon {
  transform: rotate(180deg);
}
#sidebar-toggle-icon {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth opacity on elements that fade in/out */
.clients-section,
.section-label,
.btn-add-client,
.sidebar-text {
  transition: opacity 0.2s ease;
}

/* ── INPUT PANEL EXPANSION ON SIDEBAR COLLAPSE ──────────── */
/* When sidebar collapses (280px → 48px = 232px freed),
   that 232px flows into the input column only.
   Output panel stays at 1fr — exactly the same as before. */
.sidebar.collapsed ~ .main-content .agent-console-view {
  grid-template-columns: calc(360px + (280px - 48px)) 1fr;
  /* = 360px + 232px = 592px input, output unchanged at 1fr */
}

/* ── TREND RESEARCH ACCORDION ─────────────────────────── */
.tr-report-header {
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tr-accordion {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.tr-accordion:hover {
  border-color: rgba(255,255,255,0.12);
}

.tr-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  user-select: none;
  gap: 12px;
}

.tr-accordion-header:hover {
  background: rgba(255,255,255,0.04);
}

.tr-accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tr-accordion-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.tr-client-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.tr-client-toggle input[type="checkbox"] {
  accent-color: var(--brand-color);
  width: 13px;
  height: 13px;
}

.tr-chevron {
  color: var(--text-muted);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.tr-accordion-open .tr-chevron {
  transform: rotate(180deg);
}

.tr-accordion-body {
  display: none;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.tr-accordion-open .tr-accordion-body {
  display: block;
}

/* ── PODCAST PREP ACCORDION (reuses .tr-accordion styles above) ───────── */
.pp-section-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.pp-section-toolbar .action-btn {
  padding: 6px 14px;
  font-size: 0.75rem;
}

/* Topic rows with checkboxes */
.tr-topic-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.tr-topic-item:last-child {
  border-bottom: none;
}

.tr-topic-check-label {
  flex-shrink: 0;
  padding-top: 3px;
  cursor: pointer;
}

.tr-topic-checkbox {
  accent-color: var(--brand-color);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.tr-topic-body {
  flex: 1;
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tr-topic-body strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

/* Checked topic gets a tinted row */
.tr-topic-checkbox:checked ~ * {
  color: var(--text-primary);
}

.tr-topic-item:has(.tr-topic-checkbox:checked) {
  background: rgba(210,31,4,0.04);
  border-radius: 6px;
  padding: 12px 8px;
  margin: 0 -8px;
}

/* ── AUTO-EXPANDING TEXTAREAS IN CLIENT MODAL ─────── */
#client-modal textarea {
  resize: none;
  overflow: hidden;
  min-height: 64px;
  transition: height 0.1s ease;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════════════ */

/* Mobile nav toggle — hidden on desktop */
.btn-mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-right: 12px;
  transition: var(--transition-fast);
}
.btn-mobile-nav-toggle:hover {
  color: var(--text-primary);
  border-color: var(--brand-color);
}

/* Mobile sidebar backdrop — hidden by default */
.mobile-nav-backdrop {
  display: none;
}

/* ── ≤1280px: Large desktops/laptops — collapse the widest 2-col layouts ── */
@media (max-width: 1280px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

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

  .insights-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .thumbnail-preview-workspace {
    grid-template-columns: 1fr;
  }

  .thumbnail-preview-workspace .preview-ratio-box {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ── ≤1024px: Tablets — stack agent console & studio split-panes ── */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .agent-console-view,
  .sidebar.collapsed ~ .main-content .agent-console-view {
    grid-template-columns: 1fr;
    height: auto;
  }

  .ss-capture-layout {
    grid-template-columns: 1fr;
  }

  .concepts-container {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .agent-selector-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-container {
    padding: 24px;
  }
}

/* ── ≤900px: Small tablets / large phones — slide-in sidebar nav ── */
@media (max-width: 900px) {
  .app-container {
    width: 100%;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 200;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.6);
  }

  /* Override the desktop "collapsed" icon-strip mode while in mobile nav mode */
  .sidebar.collapsed {
    width: 260px;
  }
  .sidebar.collapsed .clients-section,
  .sidebar.collapsed .section-label,
  .sidebar.collapsed .btn-add-client,
  .sidebar.collapsed .sidebar-text {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar.collapsed .brand-section {
    padding: 24px;
    justify-content: flex-start;
  }
  .sidebar.collapsed .sidebar-logo-img {
    width: auto;
    height: auto;
  }

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

  .sidebar.collapsed ~ .main-content .agent-console-view {
    grid-template-columns: 1fr;
  }

  .btn-mobile-nav-toggle {
    display: flex;
  }

  .mobile-nav-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
  }

  .header-bar {
    padding: 0 16px;
    height: auto;
    min-height: 70px;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .tab-nav {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    white-space: nowrap;
  }

  .panel-container {
    padding: 16px;
  }

  .meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── ≤640px: Phones — single-column everything, compact spacing ── */
@media (max-width: 640px) {
  .panel-container {
    padding: 12px;
  }

  .card {
    padding: 16px;
    margin-bottom: 16px;
  }

  .meta-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .agent-selector-grid {
    grid-template-columns: 1fr;
  }

  .diff-values {
    grid-template-columns: 1fr;
  }

  .modal-content,
  .edit-asset-modal-content,
  .batch-review-modal {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    padding: 20px;
  }

  /* Stack any inline two-column form grids inside modals */
  .modal-content [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .frame-vertical {
    width: 150px;
    height: 267px;
  }

  .frame-horizontal {
    width: 240px;
    height: 135px;
  }

  .active-client-info {
    gap: 10px;
  }

  .client-title-group h2 {
    font-size: 1rem;
  }

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

/* ============================================================
   PRODUCTION TRACKING — view toggle, status controls, Kanban
   ============================================================ */

.library-view-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.library-view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.library-view-btn.active {
  background: var(--bg-card);
  color: var(--brand-color);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.asset-production-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0 6px;
}

.asset-status-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
  max-width: 130px;
}

.asset-due-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 3px 6px;
  max-width: 130px;
}

.asset-due-input.overdue {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Kanban board ── */
.assets-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  flex: 0 0 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  transition: var(--transition-fast);
}

.kanban-column.drag-over {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 1px var(--brand-color);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-column-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1px 8px;
}

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.kanban-card {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: grab;
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 6px 0 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.kanban-due.overdue { color: var(--danger); font-weight: 700; }
.kanban-due.none    { opacity: 0.55; font-style: italic; }

.kanban-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.kanban-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 14px 0;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .kanban-column { flex-basis: 200px; min-width: 200px; }
}

/* ============================================================
   TEAM LOGIN + ROLES
   ============================================================ */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.login-card {
  width: min(380px, 92vw);
  padding: 36px 32px;
  border-radius: 16px;
  text-align: center;
}

.login-logo {
  max-width: 160px;
  max-height: 48px;
  object-fit: contain;
  margin-bottom: 18px;
}

.login-card h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.login-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.login-card form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 8px;
}

.login-card input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-color);
}

.login-btn {
  margin-top: 18px;
  padding: 12px;
  font-size: 0.95rem;
  width: 100%;
}

.login-error {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
  font-size: 0.82rem;
}

.login-footnote {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sidebar account chip */
.account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.account-email {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-role {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-color);
  font-weight: 700;
}

.btn-logout {
  margin-top: 5px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 4px 8px;
  cursor: pointer;
  align-self: flex-start;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Member role — hide admin-only controls */
body.role-member #btn-settings-nav,
body.role-member #btn-add-client,
body.role-member .client-three-dot,
body.role-member #panel-settings {
  display: none !important;
}

/* Sidebar collapsed — hide account text */
.sidebar.collapsed .account-info { display: none !important; }

/* ── Team Management card ───────────────────────────────────── */
.team-invite-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.team-invite-row #team-invite-email {
  flex: 1 1 200px;
  min-width: 0;
}
.team-invite-row #team-invite-role {
  flex: 0 0 auto;
  width: auto;
}
.team-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.team-list-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 14px 4px;
  text-align: center;
}
.team-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-email {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-member-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.team-role-select {
  flex: 0 0 auto;
  font-size: 0.74rem !important;
  padding: 4px 8px !important;
  width: auto !important;
}
.team-badge-pending {
  font-size: 0.66rem;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 20px;
  padding: 1px 8px;
}
.team-badge-you {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--brand-color);
  background: rgba(210, 31, 4, 0.12);
  border: 1px solid rgba(210, 31, 4, 0.25);
  border-radius: 20px;
  padding: 1px 8px;
}
.btn-team-remove {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 7px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-team-remove:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}
