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

:root {
  /* Base palette — OKLCH, neutrals tinted toward brand red (hue 27) */
  --bg:            oklch(0.10 0.008 27);
  --sidebar-bg:    oklch(0.115 0.007 27);
  --surface:       oklch(0.145 0.007 27);
  --surface-2:     oklch(0.165 0.007 27);
  --surface-hover: oklch(0.18 0.007 27);
  --border:        oklch(0.24 0.006 27);
  --border-hover:  oklch(0.32 0.006 27);

  /* Brand / accent */
  --red:           oklch(0.57 0.24 29);
  --red-dim:       oklch(0.46 0.21 29);
  --accent:        oklch(0.57 0.22 29);

  /* Text */
  --text:          oklch(0.95 0.004 27);
  --text-muted:    oklch(0.72 0.006 27);
  --text-secondary:oklch(0.58 0.006 27);
  --text-dim:      oklch(0.46 0.005 27);
  --text-primary:  oklch(0.95 0.004 27);

  /* Surfaces */
  --card-bg:       oklch(0.145 0.007 27);

  /* Radius scale */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-md:     10px;
  --radius-lg:     12px;
  --radius-pill:   999px;

  --sidebar-width: 228px;
  --shadow:        0 2px 12px oklch(0 0 0 / 0.4);
}

[data-theme="light"] {
  --bg:            oklch(0.96 0.003 27);
  --sidebar-bg:    oklch(0.99 0.002 27);
  --surface:       oklch(0.99 0.002 27);
  --surface-2:     oklch(0.95 0.003 27);
  --surface-hover: oklch(0.93 0.004 27);
  --border:        oklch(0.87 0.004 27);
  --border-hover:  oklch(0.78 0.005 27);

  --red:           oklch(0.52 0.22 29);
  --red-dim:       oklch(0.42 0.20 29);
  --accent:        oklch(0.52 0.20 29);

  --text:          oklch(0.18 0.008 27);
  --text-muted:    oklch(0.36 0.007 27);
  --text-secondary:oklch(0.50 0.006 27);
  --text-dim:      oklch(0.62 0.005 27);
  --text-primary:  oklch(0.18 0.008 27);

  --card-bg:       oklch(0.99 0.002 27);
  --shadow:        0 2px 12px oklch(0 0 0 / 0.1);
}

/* Light mode component overrides */
[data-theme="light"] .acp-card              { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
[data-theme="light"] .modal                 { background: #fff; }
[data-theme="light"] .modal-select,
[data-theme="light"] .modal-textarea,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="email"]    { background: #f9f9f9; color: var(--text); border-color: var(--border); }
[data-theme="light"] .modal-overlay         { background: rgba(0,0,0,0.35); }
[data-theme="light"] .kanban-col            { background: #f0f0f0; }
[data-theme="light"] .kanban-card           { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
[data-theme="light"] .toast                 { box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
[data-theme="light"] code                   { background: #f0f0f0; color: #c62828; }
[data-theme="light"] .acp-pop-output        { background: #f5f5f5; }
[data-theme="light"] .acp-exec-popover      { background: #fff; }
[data-theme="light"] .detail-tab-btn        { background: none; }
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active       { background: #f0f0f0; }
[data-theme="light"] .sidebar-brand-item:hover,
[data-theme="light"] .sidebar-brand-item.active { background: #f0f0f0; }
[data-theme="light"] .pipeline-row:hover    { background: var(--surface-hover); }

html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ── Focus management ── */
/* Suppress mouse/touch focus rings globally */
:focus:not(:focus-visible) { outline: none; }
/* Keyboard focus ring for all interactive elements */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Form inputs get a shadow ring instead (respects their border-radius) */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ── Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 20px 16px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 10px 8px 4px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--surface-hover); color: var(--text); }

.sidebar-section-label {
  padding: 14px 16px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.sidebar-brands {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}
.sidebar-brands::-webkit-scrollbar { width: 4px; }
.sidebar-brands::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-brand-item {
  display: flex;
  align-items: center;
  border-radius: 7px;
  transition: background 0.15s;
}
.sidebar-brand-item:hover { background: var(--surface-hover); }
.sidebar-brand-item.active { background: var(--surface-hover); }

.brand-item-link {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  padding: 7px 4px 7px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 0;
  transition: color 0.15s;
}
.brand-item-link:hover { color: var(--text); }
.sidebar-brand-item.active .brand-item-link { color: var(--text); }

.brand-delete-sidebar-btn {
  opacity: 0;
  background: none;
  border: none;
  padding: 7px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text-dim);
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.sidebar-brand-item:hover .brand-delete-sidebar-btn { opacity: 1; }
.brand-delete-sidebar-btn:hover { color: #ff4444; }

.brand-chevron-btn {
  background: none;
  border: none;
  padding: 7px 10px 7px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text-dim);
  transition: color 0.15s;
  flex-shrink: 0;
}
.brand-chevron-btn:hover { color: var(--text-muted); }

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

.sidebar-brand-group { display: flex; flex-direction: column; }

.brand-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand-chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.brand-chevron.expanded { transform: rotate(90deg); }

.sidebar-sections {
  display: flex;
  flex-direction: column;
  padding: 6px 0 10px 16px;
}
.sidebar-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 16px 10px 7px;
  border-top: 1px solid var(--border);
}
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.sidebar-group-toggle:hover { color: var(--text-muted); }
.group-chevron {
  opacity: 0.5;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.group-chevron.expanded {
  transform: rotate(0deg);
}
.group-chevron:not(.expanded) {
  transform: rotate(-90deg);
}
.sidebar-section-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-top: 2px;
}
.sidebar-section-item:hover { background: var(--surface-hover); color: var(--text-muted); }
.sidebar-section-item.active { background: var(--surface-hover); color: var(--text); }

.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.6;
}
.sidebar-section-item.active .nav-icon,
.sidebar-section-item:hover .nav-icon { opacity: 1; }

.sidebar-add-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 6px 10px 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 2px;
}
.sidebar-add-item:hover { background: var(--surface-hover); color: var(--text-muted); }

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-new-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-new-brand:hover { border-color: var(--text-dim); color: var(--text-muted); }

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text-muted); border-color: var(--text-dim); }
.theme-toggle-icon  { font-size: 0.85rem; line-height: 1; }
.theme-toggle-label { font-weight: 500; }

/* ── Mobile header (hidden on desktop) ── */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.mobile-menu-btn:hover { background: var(--surface-hover); color: var(--text); }
.mobile-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ── Mobile nav overlay ── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.55);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
}
.mobile-nav-overlay.active {
  display: block;
  opacity: 1;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

#view-container {
  min-height: 100vh;
}

/* ── All Brands view ── */
.view-header {
  padding: 36px 40px 0;
  margin-bottom: 28px;
}
.view-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}
.view-header p { color: var(--text-muted); font-size: 0.9rem; }

.view-body { padding: 0 40px 60px; }

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

.brand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
  display: block;
}
.brand-card:hover { background: var(--surface-hover); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

.brand-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-card-name .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.platform-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.platform-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.platform-badge.connected { border-color: #2a3a2a; background: #1a2a1a; color: #6fcf6f; }
.platform-badge.disconnected { color: var(--text-dim); }

.brand-card-stats {
  display: flex;
  gap: 20px;
}
.brand-stat { font-size: 0.82rem; color: var(--text-muted); }
.brand-stat strong { color: var(--text); font-weight: 600; display: block; font-size: 1rem; }

/* ── Brand view ── */
.brand-view-header {
  padding: 36px 40px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.brand-view-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-color-square {
  width: 20px; height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
}
.brand-header-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-header-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.brand-view-breadcrumb {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
.brand-view-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.btn-edit-brand {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-edit-brand:hover { border-color: var(--text-dim); color: var(--text); }

.tab-content { padding: 8px 40px 60px; }

/* ── Overview tab ── */
.platform-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.platform-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.platform-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.platform-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.platform-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.platform-status-dot.online { background: #6fcf6f; }
.platform-status-dot.offline { background: var(--text-dim); }

.platform-card-stats { display: flex; flex-direction: column; gap: 10px; }
.pstat { display: flex; flex-direction: column; }
.pstat-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }
.pstat-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }

.pstat-row { display: flex; gap: 20px; }
.pstat-row .pstat-value { font-size: 1rem; }

.platform-card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 0 8px;
  text-align: center;
}
.platform-card-empty p { font-size: 0.82rem; color: var(--text-dim); }

.platform-view-link {
  margin-top: 14px;
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.platform-view-link:hover { color: var(--text-muted); }

/* Recent activity */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.acp-publish-all-btn {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: none;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  transition: background .15s, color .15s;
}
.acp-publish-all-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.acp-publish-all-btn:disabled { opacity: .5; cursor: not-allowed; }

.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.activity-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #252525;
  display: block;
}
.activity-info { padding: 10px; }
.activity-title {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}
.activity-meta { font-size: 0.72rem; color: var(--text-dim); display: flex; gap: 8px; flex-wrap: wrap; }
.activity-card { text-decoration: none; color: inherit; display: block; transition: border-color 0.15s; }
.activity-card:hover { border-color: var(--accent); }
.activity-thumb-empty { width: 100%; aspect-ratio: 16/9; background: #252525; display: block; }

.activity-platform-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.activity-platform-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── YouTube tab ── */
.yt-channel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.yt-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
  flex-shrink: 0;
}
.yt-avatar-placeholder {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF0000, #cc0000);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.yt-channel-info h2 { font-size: 1.1rem; font-weight: 700; }
.yt-channel-info .handle { font-size: 0.82rem; color: var(--text-dim); margin-top: 2px; }

.yt-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 28px;
}
.yt-stat {
  background: var(--surface);
  padding: 14px 12px;
  text-align: center;
}
.yt-stat-value { font-size: 1.2rem; font-weight: 700; }
.yt-stat-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.video-list { display: flex; flex-direction: column; gap: 8px; }
.video-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.video-item:hover { background: var(--surface-hover); }
.video-thumb {
  width: 88px; height: 50px;
  border-radius: 5px;
  object-fit: cover;
  background: #252525;
  flex-shrink: 0;
}
.video-info { flex: 1; min-width: 0; }
.video-title {
  font-size: 0.85rem; font-weight: 500; line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}
.video-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.video-meta span { font-size: 0.74rem; color: var(--text-dim); display: flex; align-items: center; gap: 3px; }

/* ── Placeholder tabs (Instagram / Facebook) ── */
.platform-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-dim);
}
.platform-placeholder-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  opacity: 0.5;
}
.platform-placeholder h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.platform-placeholder p { font-size: 0.85rem; max-width: 280px; line-height: 1.5; }
.coming-soon-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Connect placeholder (YouTube not connected) ── */
.connect-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
}
.connect-placeholder h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.connect-placeholder p { font-size: 0.85rem; color: var(--text-dim); max-width: 260px; line-height: 1.5; }

/* ── Buttons ── */
.btn-connect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.btn-connect:hover { background: var(--red-dim); }

.btn-disconnect {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-disconnect:hover { border-color: var(--red); color: var(--red); }

.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--red-dim); }

.btn-secondary {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
}
.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
}
.modal-field { margin-bottom: 18px; }
.modal-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.modal-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.modal-field input:focus { border-color: var(--text-dim); }

.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
  border: 2px solid transparent;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { outline: 2px solid #fff; outline-offset: 2px; }

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

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.toast.success { background: #1a3a1a; color: #6fcf6f; border: 1px solid #2a5a2a; }
.toast.error   { background: #3a1a1a; color: #ff6b6b; border: 1px solid #5a2a2a; }
.toast.hidden  { opacity: 0; pointer-events: none; }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; min-height: 180px; }
.skeleton-row  { height: 13px; }
.skeleton-circle { border-radius: 50% !important; }

/* ── Kanban board ── */
.kanban-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.kanban-count {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 24px;
  align-items: flex-start;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.kanban-column {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
  transition: border-color 0.15s;
}
.kanban-column.drag-over {
  border-color: #555;
  background: #1e1e1e;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.kanban-stage-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-col-count {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 7px;
  font-weight: 600;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 60px;
}
.kanban-cards::-webkit-scrollbar { width: 3px; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--border); }

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.kanban-card:hover {
  border-color: #3a3a3a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.kcard-title {
  font-size: 0.83rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 9px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kcard-platforms { display: flex; gap: 5px; }
.kcard-platform-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.kcard-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Content modal ── */
.modal-lg { width: 520px; }

.modal-row {
  display: flex;
  gap: 14px;
}

.modal-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.modal-select:focus { border-color: var(--text-dim); }

.modal-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 10px 12px;
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.modal-textarea:focus { border-color: var(--text-dim); }

.platform-status-rows { display: flex; flex-direction: column; gap: 8px; }
.pstatus-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pstatus-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  width: 72px;
  flex-shrink: 0;
}
.pstatus-select { flex: 1; width: auto; min-width: 0; }
.modal-date {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 9px 10px;
  width: 130px;
  flex-shrink: 0;
  transition: border-color 0.15s;
  color-scheme: dark;
}
.modal-date:focus { border-color: var(--text-dim); }

/* ── Platform picker ── */
.platform-picker { display: flex; flex-direction: column; gap: 8px; }

.platform-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
}
.platform-option:hover { border-color: #3a3a3a; background: #141414; }
.platform-option.available:hover { border-color: var(--red); }

.platform-option-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.platform-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.platform-option-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.platform-option-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.platform-option-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  flex-shrink: 0;
}
.platform-option-badge.available {
  background: #1a0000;
  border-color: var(--red);
  color: var(--red);
}
.platform-option-badge.disconnect {
  background: #1a1200;
  border-color: #a07800;
  color: #f0b800;
}

.btn-danger {
  background: none;
  border: 1px solid #5a2a2a;
  color: #ff6b6b;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #3a1a1a; }

.btn-render {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #1a4a2a;
  color: #4CAF50;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-render:hover { background: #0f2a1a; }
.btn-render:disabled { opacity: 0.5; cursor: default; }

/* ── Content Type Picker ── */
.content-type-picker {
  display: flex;
  gap: 8px;
}
.content-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.15s;
  font-size: 0.83rem;
  font-weight: 500;
}
.content-type-btn small {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
}
.content-type-btn .content-type-icon { font-size: 1.1rem; }
.content-type-btn:hover { border-color: var(--text-dim); color: var(--text-muted); }
.content-type-btn.active {
  border-color: var(--red);
  background: #1a0000;
  color: var(--text);
}
.content-type-btn.active small { color: var(--text-muted); }

/* ── Kanban card type + agent bar ── */
.kcard-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.kcard-agent-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  margin: 6px 0 4px;
  overflow: hidden;
}
.kcard-agent-progress {
  height: 100%;
  background: #4CAF50;
  border-radius: 2px;
  transition: width 0.3s;
}
.kcard-score-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.kcard-score-badge.score-win   { background: rgba(76,175,80,0.18); color: #4CAF50; }
.kcard-score-badge.score-avg   { background: rgba(255,152,0,0.18);  color: #FF9800; }
.kcard-score-badge.score-miss  { background: rgba(239,83,80,0.18);  color: #EF5350; }

/* ── Agent status in content modal ── */
.agent-status-label-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.agent-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.agent-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.agent-status-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.agent-status-label {
  font-size: 0.75rem;
  font-weight: 600;
}
.agent-report-summary {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 4px 6px 6px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}

/* ── Content Calendar ── */
.cal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cal-month-label {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 172px;
  text-align: center;
  letter-spacing: -0.2px;
}
.cal-nav-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cal-nav-btn:hover { border-color: var(--text-dim); color: var(--text); }

.cal-today-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-today-btn:hover { border-color: var(--text-dim); color: var(--text); }

.cal-month-summary {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.cal-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-dow {
  background: var(--surface);
  padding: 8px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-align: center;
}

.cal-day {
  background: var(--surface);
  min-height: 96px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-day-faded { background: #131313; }
.cal-day-today { background: rgba(108, 99, 255, 0.06); }

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  margin-bottom: 2px;
  flex-shrink: 0;
}
.cal-day-num.is-today {
  background: var(--red);
  color: #fff;
}

.cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-hover);
  font-size: 0.7rem;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.15s;
}
.cal-chip:hover { opacity: 0.75; }
.cal-chip-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.cal-chip-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.cal-overflow {
  font-size: 0.68rem;
  color: var(--text-dim);
  padding: 1px 5px;
}

/* ── Agents tab ── */
.agents-loading {
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.agents-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Stat row */
.agents-stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.agents-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 120px;
  flex: 1;
}
.agents-stat-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1.1;
}
.agents-stat-value.agents-stat-active { color: #d4792a; }
.agents-stat-value.agents-stat-error  { color: #d4453e; }
.agents-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 3px;
}

/* Section */
.agents-section { display: flex; flex-direction: column; gap: 10px; }
.agents-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.agents-section-count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Throughput strip */
.agent-throughput-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.agent-throughput-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  flex: 1;
}
.agent-tp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.agent-tp-pulse {
  animation: pulse-ring 1.2s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(255,152,0,0); }
}
.agent-tp-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.agent-tp-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

/* Pipeline table */
.pipeline-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pipeline-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: #161616;
}
.pipeline-header-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pipeline-header-agents {
  display: flex;
  gap: 4px;
  margin: 0 12px;
}
.pipeline-header-agent {
  width: 36px;
  text-align: center;
  font-size: 0.62rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-header-pct {
  font-size: 0.7rem;
  color: var(--text-dim);
  width: 56px;
  text-align: right;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Pipeline rows */
.pipeline-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  gap: 12px;
}
.pipeline-row:last-child { border-bottom: none; }
.pipeline-row:hover { background: var(--surface-hover); }

.pipeline-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pipeline-row-title {
  font-size: 0.83rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.pipeline-stage-chip {
  font-size: 0.65rem;
  border: 1px solid;
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: capitalize;
}

.pipeline-cells {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.pipeline-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.pipeline-cell-running {
  animation: cell-pulse 1s ease-in-out infinite;
}
@keyframes cell-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

.pipeline-row-tail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  width: 76px;
}
.pipeline-mini-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.pipeline-mini-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.pipeline-mini-active {
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.pipeline-pct {
  font-size: 0.72rem;
  color: var(--text-dim);
  width: 30px;
  text-align: right;
}

/* Empty state */
.agents-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

@media (max-width: 900px) {
  .platform-cards { grid-template-columns: 1fr; }
}

/* ── Agent Control Panel ──────────────────────────────────────────────────── */
.acp-section {
  margin-bottom: 8px;
}

/* Setup banner */
.acp-setup-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.acp-setup-icon { font-size: 1.5rem; margin-top: 2px; }
.acp-setup-body { font-size: 0.85rem; color: var(--text-dim); line-height: 1.6; }
.acp-setup-body strong { color: var(--text-muted); }
.acp-setup-body code {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.82rem;
  color: var(--accent);
  font-family: monospace;
}
.acp-setup-body p { margin: 4px 0 0; }

/* Summary stat boxes */
.acp-summary-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}
.acp-summary-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.acp-summary-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}
.acp-summary-val.acp-val-on    { color: #3e9f5f; }
.acp-summary-val.acp-val-warn  { color: #d4792a; }
.acp-summary-val.acp-val-error { color: #d4453e; }
.acp-summary-lbl {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Pipeline tier groups */
.acp-group { margin-bottom: 0; }

/* Tier container — no box, no line (accent lives on individual cards) */
.acp-tier {
  padding-left: 0;
}

/* Tier header (tag + title + subtitle) */
.acp-tier-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.acp-tier-tag {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.acp-tier-title-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.acp-tier-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}
.acp-tier-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Downward connector between tiers */
.acp-tier-connector {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 48px;
  position: relative;
}
.acp-tier-connector::before {
  content: '';
  position: absolute;
  top: 0; bottom: 50%;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,0.08);
  transform: translateX(-50%);
}
.acp-tier-arrow {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.15);
  z-index: 1;
  line-height: 1;
}

/* Analytics → Intelligence feedback annotation */
.acp-feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0 8px;
}
.acp-feedback-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #9C27B044, transparent);
}
.acp-feedback-label {
  font-size: 0.62rem;
  color: #9C27B0;
  white-space: nowrap;
  opacity: 0.8;
  text-align: center;
}

/* Legacy label (kept for non-tier groups if any) */
.acp-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* Card grid */
.acp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* Agent card */
.acp-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.acp-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.acp-card-active  { border-color: rgba(76,175,80,0.25); }
.acp-card-inactive { opacity: 0.75; }
.acp-card-missing { opacity: 0.55; }

/* Card top section */
.acp-card-top {
  padding: 14px 16px 12px;
  flex: 1;
}

/* Header row: stage badge + type + model */
.acp-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.acp-stage-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.acp-type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.acp-model {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: monospace;
}

/* Name + description */
.acp-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.acp-card-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Card footer */
.acp-card-foot {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Status row */
.acp-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Colored status badges */
.acp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.acp-status-active {
  background: #4CAF5022;
  color: #4CAF50;
  animation: acp-pulse 2.5s ease-in-out infinite;
}
.acp-status-inactive {
  background: #FF980022;
  color: #FF9800;
}
.acp-status-missing {
  background: #44444422;
  color: var(--text-dim);
}

@keyframes acp-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.acp-trigger {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Last run */
.acp-last-run {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.acp-run-never { font-style: italic; }
.acp-run-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  flex-shrink: 0;
}
.acp-run-ok      { background: rgba(76,175,80,0.2);  color: #4CAF50; }
.acp-run-error   { background: rgba(244,67,54,0.2);  color: #f44336; }
.acp-run-running { background: rgba(255,152,0,0.2);  color: #FF9800; }
.acp-run-ago  { color: var(--text-dim); }
.acp-run-dur  { color: var(--text-dim); }
.acp-run-total {
  margin-left: auto;
  color: var(--text-dim);
}

/* Toggle button */
.acp-toggle {
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.acp-toggle:hover  { opacity: 0.8; }
.acp-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.acp-toggle-start { background: rgba(76,175,80,0.15); color: #4CAF50; }
.acp-toggle-pause { background: rgba(255,152,0,0.15); color: #FF9800; }

/* Execution history */
.acp-exec-history {
  margin-top: 2px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.acp-exec-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.67rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.acp-exec-total { color: var(--text-dim); }
.acp-exec-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.acp-exec-row:last-child { border-bottom: none; }
.acp-exec-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.acp-exec-dur {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

/* Errors card (inline with Watchdog) */
.acp-errors-card .acp-card-foot {
  overflow-y: auto;
  max-height: 280px;
}
.acp-errors-card-clean .acp-card-foot { overflow: hidden; }
.acp-errors-count-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #f44336;
  background: rgba(244,67,54,0.12);
  border: 1px solid rgba(244,67,54,0.3);
  border-radius: 10px;
  padding: 2px 8px;
  margin-bottom: 10px;
}
.acp-errors-clean {
  font-size: 0.8rem;
  color: #4CAF50;
  padding: 4px 0;
}
.acp-errors-group-label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.acp-error-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.acp-error-row:last-child { border-bottom: none; }
.acp-error-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.acp-error-brand {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.acp-error-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acp-error-agents {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.acp-error-agent {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}
.acp-ea-failed { background: rgba(244,67,54,0.15);  color: #f44336; }
.acp-ea-stuck  { background: rgba(255,152,0,0.15);  color: #FF9800; }
.acp-error-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.acp-error-dt {
  font-size: 0.67rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.acp-retry-btn {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(244,67,54,0.15);
  color: #f44336;
  border: none;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.acp-retry-btn:hover    { opacity: 0.8; }
.acp-retry-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Per-card publish button */
.acp-publish-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.acp-publish-btn {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-dim);
  background: none;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.acp-publish-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.acp-publish-btn-on {
  border-color: #4CAF5055;
  color: #4CAF50;
}
.acp-publish-btn-on:hover:not(:disabled) { border-color: #f44336; color: #f44336; }
.acp-publish-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Content detail view ──────────────────────────────────────────────────── */
.detail-loading {
  padding: 40px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.content-detail-view {
  max-width: 900px;
  padding: 0 0 60px;
}

.detail-back {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
}
.detail-back-link:hover { color: var(--text-muted); }

.detail-header { margin-bottom: 24px; }

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.detail-stage-chip,
.detail-type-chip,
.detail-score-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-type-chip {
  background: var(--surface-2);
  color: var(--text-dim);
}
.detail-score-chip.score-win  { background: rgba(76,175,80,0.15);  color: #4CAF50; }
.detail-score-chip.score-avg  { background: rgba(255,152,0,0.15);  color: #FF9800; }
.detail-score-chip.score-miss { background: rgba(239,83,80,0.15);  color: #EF5350; }

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 6px;
}

.detail-angle {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Tabs */
.detail-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.detail-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.detail-tab-btn:hover { color: var(--text-muted); }
.detail-tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Tab: Brief ── */
.detail-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.detail-section-full { grid-column: 1 / -1; }

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.detail-field-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.detail-field-value {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.detail-prow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
}
.detail-prow-date { color: var(--text-dim); font-size: 0.78rem; margin-left: auto; }

.detail-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-notes {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ── Tab: Script ── */
.detail-script-header {
  display: flex;
  gap: 20px;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.detail-script {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-muted);
  white-space: pre-wrap;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

/* ── Tab: Creative — hooks ── */
.detail-hooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.detail-hook-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.detail-hook-card.hook-selected {
  border-color: var(--accent);
  background: rgba(99,102,241,0.06);
}
.hook-selected-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}
.detail-hook-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.detail-hook-spoken {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.4;
}
.detail-hook-overlay {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--surface);
  border-radius: 4px;
  padding: 4px 8px;
}
.detail-hook-rationale {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Titles */
.detail-title-variants {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 16px;
}
.detail-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 6px;
}
.detail-title-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 14px;
}

.detail-caption-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 6px;
  margin: 6px 0;
}
.detail-caption-text {
  width: 100%;
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: 2px;
}

/* Thumbnail */
.detail-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 12px 0;
}
.detail-thumb-concept,
.detail-thumb-text-overlay {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.detail-thumb-text-overlay {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.detail-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-palette-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: default;
}
.detail-ai-prompt {
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 12px;
  line-height: 1.6;
  font-style: italic;
}

/* ── Tab: Distribution ── */
.detail-distrib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.detail-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(from var(--tag-color) r g b / 0.12);
  color: var(--tag-color);
  border: 1px solid rgba(from var(--tag-color) r g b / 0.25);
}
/* Fallback for browsers without relative color syntax */
.detail-tag { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

.detail-schedule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.detail-schedule-time { margin-left: auto; color: var(--text-dim); font-size: 0.8rem; }

/* ── Tab: Performance ── */
.detail-score-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.detail-score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 3px solid currentColor;
}
.detail-score-circle.score-win  { color: #4CAF50; background: rgba(76,175,80,0.1); }
.detail-score-circle.score-avg  { color: #FF9800; background: rgba(255,152,0,0.1); }
.detail-score-circle.score-miss { color: #EF5350; background: rgba(239,83,80,0.1); }

.detail-score-meta { display: flex; flex-direction: column; gap: 6px; }
.detail-score-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.detail-score-context { font-size: 0.85rem; color: var(--text-dim); max-width: 400px; }

.detail-verdict-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
}
.detail-verdict-chip.verdict-win   { background: rgba(76,175,80,0.15);  color: #4CAF50; }
.detail-verdict-chip.verdict-average { background: rgba(255,152,0,0.15); color: #FF9800; }
.detail-verdict-chip.verdict-miss  { background: rgba(239,83,80,0.15);  color: #EF5350; }

.detail-breakdown { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.detail-bd-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
}
.detail-bd-label { color: var(--text-muted); }
.detail-bd-bar-wrap { background: var(--border); border-radius: 3px; height: 6px; overflow: hidden; }
.detail-bd-bar { height: 100%; border-radius: 3px; transition: width 0.4s; }
.detail-bd-score { color: var(--text-dim); text-align: right; }
.detail-bd-note { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-dim); padding-left: 172px; margin-top: -6px; }

.detail-pm-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--accent) 20%, var(--border));
  border-radius: var(--radius-sm);
}
.detail-pm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 16px 0;
}

.detail-verdicts { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.detail-verdict-row {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.detail-verdict-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  min-width: 52px;
}

.detail-next-rec {
  margin-top: 20px;
  padding: 14px 16px;
  background: color-mix(in oklch, var(--accent) 7%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--accent) 18%, var(--border));
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-next-rec-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* ── Tab: Repurpose ── */
.detail-clip-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-clip-num {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.detail-clip-title { font-size: 1rem; font-weight: 700; }
.detail-clip-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.detail-clip-meta span::before { content: '·'; margin-right: 12px; }
.detail-clip-meta span:first-child::before { content: ''; margin: 0; }
.detail-clip-hook {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-muted);
  padding: 10px 14px;
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--accent) 18%, var(--border));
  border-radius: var(--radius-sm);
}
.detail-clip-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; }
.detail-clip-why  { font-size: 0.82rem; color: var(--text-dim); line-height: 1.5; }

/* View outputs button in content modal */
.btn-view-outputs {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 0;
  transition: opacity 0.15s;
}
.btn-view-outputs:hover { opacity: 0.75; }

/* Empty state */
.detail-empty {
  color: var(--text-dim);
  font-size: 0.88rem;
  padding: 32px 0;
  text-align: center;
}
/* ── Brand Intelligence ───────────────────────────────────────────────────── */
.intel-updated {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
}
.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}
.intel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.intel-card-wide { grid-column: span 2; }
.intel-card-full { grid-column: 1 / -1; }
.intel-card-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.intel-count {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.intel-niche   { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.intel-audience { font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; }
.intel-chips   { display: flex; flex-wrap: wrap; gap: 6px; }
.intel-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 500;
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 22%, var(--border));
  white-space: nowrap;
}
.theme-chip {
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  color: var(--text-muted);
  border-color: color-mix(in oklch, var(--accent) 22%, var(--border));
}

/* ── Mid-range: icon-only sidebar at ≤1024px ── */
@media (max-width: 1024px) and (min-width: 701px) {
  :root { --sidebar-width: 52px; }
  .sidebar-logo span:not(.live-dot) { display: none; }
  .sidebar-logo { justify-content: center; padding: 18px 0; }
  .sidebar-section-label { display: none; }
  .brand-item-name { display: none; }
  .brand-dot { width: 10px; height: 10px; }
  .brand-chevron-btn { display: none; }
  .brand-delete-sidebar-btn { display: none; }
  .sidebar-add-item span { display: none; }
  .sidebar-new-brand span:not(svg) { display: none; }
  .sidebar-new-brand { justify-content: center; padding: 8px; }
  .theme-toggle-label { display: none; }
  .theme-toggle { justify-content: center; }
  .sidebar-group-label { display: none; }
  .sidebar-section-item span:last-child { display: none; }
  .sidebar-section-item { justify-content: center; padding: 6px; }
  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 8px; }
  .sidebar-quota { display: none; }
}

@media (max-width: 700px) {
  .app-layout { flex-direction: column; }
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { height: calc(100vh - 52px); overflow-y: auto; }
  .view-header, .brand-view-header, .brand-tabs, .tab-content, .view-body { padding-left: 20px; padding-right: 20px; }
  .intel-card-wide { grid-column: span 1; }
  body { overflow: auto; }
}

/* ── Brand Kit ──────────────────────────────────────────────────────────────── */
.bk-page {
  padding: 32px 40px 60px;
  max-width: 100%;
}

.bk-section-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bk-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.bk-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.bk-columns {
  display: flex;
  gap: 24px;
  align-items: start;
}

.bk-col {
  min-width: 0;
}

.bk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.bk-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.bk-subtitle {
  font-size: 0.875rem;
  color: var(--text-dim);
}

.bk-section-label {
  display: flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.bk-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bk-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}



.bk-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  color: var(--text-muted);
}

/* ── Add form ── */
.bk-add-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.bk-field-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 8px 12px;
  font-family: inherit;
  transition: border-color 0.15s;
  min-width: 160px;
}
.bk-field-input:focus { border-color: var(--accent); }
.bk-field-url { flex: 1; min-width: 240px; }

/* ── Buttons ── */
.bk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.bk-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.bk-btn-primary:hover { opacity: 0.88; }
.bk-btn-ghost {
  background: none;
  color: var(--text-muted);
  border-color: var(--border);
}
.bk-btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.bk-btn-copy {
  background: none;
  color: var(--text-dim);
  border-color: var(--border);
  font-size: 0.75rem;
  padding: 5px 10px;
}
.bk-btn-copy:hover { background: var(--surface-hover); color: var(--text-muted); }
.bk-btn-delete {
  background: none;
  color: var(--text-dim);
  border: none;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
}
.bk-btn-delete:hover { background: color-mix(in oklch, #d4453e 12%, var(--surface)); color: #d4453e; }
.bk-btn-icon {
  background: none;
  color: var(--text-dim);
  border: 1px solid transparent;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
}
.bk-btn-icon:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.bk-btn-danger:hover { background: color-mix(in oklch, #d4453e 12%, var(--surface)) !important; color: #d4453e !important; }

/* ── Table column sizing ── */
.bk-col-name { font-weight: 500; color: var(--text); }
.bk-col-url  { max-width: 340px; }
.bk-col-actions { white-space: nowrap; }
.bk-asset-actions { display: flex; align-items: center; gap: 4px; }
.bk-name-display { cursor: pointer; }
.bk-name-edit { width: 100%; box-sizing: border-box; }

/* ── Assets table ── */
.bk-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.bk-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.bk-asset-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.bk-asset-row:last-child { border-bottom: none; }
.bk-asset-row:hover { background: var(--surface-hover); }

.bk-asset-row td {
  padding: 12px 14px;
  vertical-align: middle;
}

.bk-asset-id code {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.bk-asset-name { font-weight: 500; color: var(--text); }

.bk-asset-url { max-width: 340px; }
.bk-url-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk-url-link:hover { color: var(--accent); text-decoration: underline; }

.bk-asset-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ── Products library ── */
.bk-empty-inline {
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 12px 0;
}

.bk-prod-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.bk-type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.bk-type-image  { background: color-mix(in oklch, var(--accent) 12%, var(--surface)); color: var(--accent); border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent); }
.bk-type-video  { background: color-mix(in oklch, oklch(0.65 0.18 270) 12%, var(--surface)); color: oklch(0.65 0.18 270); border: 1px solid color-mix(in oklch, oklch(0.65 0.18 270) 25%, transparent); }
.bk-type-file   { background: color-mix(in oklch, var(--text-muted) 12%, var(--surface)); color: var(--text-muted); border: 1px solid color-mix(in oklch, var(--text-muted) 25%, transparent); }
.bk-type-pdf    { background: color-mix(in oklch, oklch(0.6 0.2 20) 12%, var(--surface)); color: oklch(0.6 0.2 20); border: 1px solid color-mix(in oklch, oklch(0.6 0.2 20) 25%, transparent); }

.bk-thumb-video {
  background: color-mix(in oklch, oklch(0.65 0.18 270) 10%, var(--surface));
  color: oklch(0.65 0.18 270);
}

.bk-ga-tags {
  max-width: 180px;
}

.bk-ga-tags .bk-theme-tag {
  display: inline-flex;
  margin: 1px 2px;
}

.bk-theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.bk-theme-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent);
}

.bk-themes-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  padding: 6px 0;
}

.bk-prod-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 3px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Product add/edit form ── */
.bk-prod-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.bk-prod-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 16px;
}

.bk-prod-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.bk-field-textarea {
  resize: vertical;
  min-height: 72px;
}

.bk-prod-img-preview {
  margin-top: 8px;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}

.bk-prod-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bk-prod-url-row .bk-field-input { flex: 1; }
.bk-prod-upload-btn { white-space: nowrap; cursor: pointer; }

/* ── Settings stack ── */
.bk-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bk-settings-row {
  display: flex;
  gap: 16px;
}

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

.bk-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 14px 0 0;
  margin-top: 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.bk-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Aspect ratio toggles ── */
.bk-toggle-group {
  display: flex;
  gap: 8px;
}

.bk-toggle {
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.bk-toggle:hover { border-color: var(--accent); color: var(--text); }
.bk-toggle-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.bk-toggle-on:hover { opacity: 0.88; }

/* ── Drag-drop upload zone ── */
.bk-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 24px;
  min-height: 180px;
  box-sizing: border-box;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.875rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.bk-drop-zone:hover,
.bk-drop-active {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 6%, var(--surface));
}

/* ── Upload progress ── */
.bk-upload-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.bk-prog-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.bk-prog-bar {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.bk-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

/* ── Thumbnail column ── */
.bk-col-thumb {
  width: 52px;
  padding: 8px 8px 8px 14px !important;
}
.bk-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.bk-thumb-file {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

/* ── Empty state ── */
.bk-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-dim);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.bk-loading {
  padding: 40px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Shared utility classes (used by video templates) ── */
.vt-color-swatch {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}
.vt-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.vt-upload-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.vt-upload-btn input[type="file"] { display: none; }

/* ── Video Template Builder ─────────────────────────────────────────────────── */
/* ── Video Templates — table view ───────────────────────────────────────────── */
.vt-table-view {
  padding: 28px 32px;
  overflow-y: auto;
  height: calc(100vh - 120px);
  box-sizing: border-box;
}
.vt-table-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.vt-table-title {
  font-size: 18px; font-weight: 700; margin-bottom: 4px;
}
.vt-table-sub {
  font-size: 12px; color: var(--text-dim);
}
.vt-table-actions { display: flex; gap: 8px; }
.vt-new-tpl-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 7px 14px;
}

.vt-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.vt-table thead tr {
  border-bottom: 1px solid var(--border);
}
.vt-table th {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-dim);
  padding: 0 12px 10px; text-align: left;
}
.vt-table th:first-child { padding-left: 0; }
.vt-tbl-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.vt-tbl-row:hover { background: rgba(255,255,255,.03); }
.vt-tbl-row td { padding: 14px 12px; }
.vt-tbl-row td:first-child { padding-left: 0; }
.vt-tbl-name { font-weight: 600; }
.vt-tbl-ar   { width: 80px; }
.vt-tbl-dims { width: 110px; font-size: 12px; }
.vt-tbl-date { width: 120px; font-size: 12px; }
.vt-tbl-actions { width: 120px; text-align: right; }
.vt-tbl-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 5px; border: 1px solid var(--border);
  background: none; color: var(--text-secondary);
  cursor: pointer; transition: background .12s, color .12s;
  margin-left: 4px;
}
.vt-tbl-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.vt-tbl-btn-del:hover { background: rgba(239,83,80,.12); color: #ef5350; border-color: #ef5350; }

.vt-empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 64px 0; color: var(--text-dim);
  text-align: center;
}
.vt-empty-state p { font-size: 13px; margin: 0; }

/* ── Video Templates — edit view ────────────────────────────────────────────── */
.vt-edit-view {
  display: flex; flex-direction: column;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.vt-edit-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.vt-back-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.vt-back-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }

.vt-name-inline {
  font-size: 15px !important;
  font-weight: 700 !important;
  border-bottom: 1px solid transparent !important;
  flex: 1;
}
.vt-name-inline:focus { border-bottom-color: var(--accent) !important; }

.vt-edit-body {
  display: grid;
  grid-template-columns: 70% 30%;
  flex: 1; min-height: 0;
  overflow: hidden;
}

/* Left wizard panel */
.vt-edit-left {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Right preview panel */
.vt-edit-right {
  background: oklch(0.07 0.005 27);
  overflow: hidden;
}

/* Preserve legacy ar-badge + misc */

.vt-ar-badge {
  font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px;
  flex-shrink: 0;
}
.vt-ar-short { background: rgba(108,99,255,.2); color: #a89dff; }
.vt-ar-long  { background: rgba(0,191,165,.2);  color: #00bfa5; }

.vt-tpl-name { font-size: 12px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-delete-btn {
  font-size: 10px; color: var(--text-muted); background: none; border: none;
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
  transition: color .15s, background .15s;
}
.vt-delete-btn:hover { color: #ef5350; background: rgba(239,83,80,.1); }

/* Editor base */
#vt-panel-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.vt-editor-header { display: flex; align-items: center; gap: 14px; }
.vt-name-input {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  background: none; border: none; border-bottom: 1px solid transparent;
  flex: 1;
  transition: border-color .15s;
}
.vt-name-input:focus { border-bottom-color: var(--accent); }
.vt-meta-info { font-size: 12px; color: var(--text-muted); }

/* JSON editor wrapper */
.vt-json-editor-wrap { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.vt-json-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}

/* Timeline */
.vt-timeline {
  display: flex; border-radius: 10px; overflow: hidden;
  height: 54px; border: 1px solid var(--border);
}
.vt-timeline-seg {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px; padding: 4px 6px;
  background: rgba(108,99,255,.1);
  border-right: 1px solid var(--border);
  min-width: 0; overflow: hidden; cursor: default;
  transition: background .15s;
}
.vt-timeline-seg:last-child { border-right: none; }
.vt-timeline-seg:hover { background: rgba(108,99,255,.2); }
.vt-seg-icon  { font-size: 14px; }
.vt-seg-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vt-seg-dur   { font-size: 9px; color: var(--text-muted); }

/* Scene cards */
.vt-scenes { display: flex; flex-direction: column; gap: 8px; }
.vt-scene-card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; transition: border-color .15s;
}
.vt-scene-card.vt-scene-open { border-color: var(--accent); }

.vt-scene-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer;
  background: var(--card-bg);
  transition: background .15s;
}
.vt-scene-header:hover { background: var(--hover-bg, rgba(255,255,255,.03)); }

.vt-scene-left { display: flex; align-items: center; gap: 12px; }
.vt-scene-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(108,99,255,.15); color: var(--accent);
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vt-scene-icon   { font-size: 18px; }
.vt-scene-type   { font-size: 13px; font-weight: 700; }
.vt-scene-summary { font-size: 11px; color: var(--text-muted); }

.vt-scene-actions { display: flex; align-items: center; gap: 6px; }
.vt-move-btn {
  font-size: 13px; background: none; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; cursor: pointer; color: var(--text-secondary);
  transition: border-color .15s, color .15s;
}
.vt-move-btn:hover { border-color: var(--accent); color: var(--accent); }
.vt-remove-scene-btn {
  font-size: 11px; background: none; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; cursor: pointer; color: var(--text-muted);
  transition: color .15s, border-color .15s;
}
.vt-remove-scene-btn:hover { color: #ef5350; border-color: #ef5350; }
.vt-chevron { font-size: 10px; color: var(--text-muted); }

.vt-scene-body {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; gap: 12px;
}

.vt-field-row { display: flex; align-items: center; gap: 12px; }
.vt-field-label { font-size: 12px; color: var(--text-secondary); min-width: 110px; flex-shrink: 0; }
.vt-input {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--text-primary);
  transition: border-color .15s;
}
.vt-input:focus { border-color: var(--accent); }
.vt-input-sm { width: 80px; }
.vt-select {
  flex: 1; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--text-primary);
  cursor: pointer;
}

/* Add scene bar */
.vt-add-scene {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
}
.vt-add-scene-btn {
  font-size: 12px; font-weight: 600; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  background: none; color: var(--text-secondary); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.vt-add-scene-btn:hover { border-color: var(--accent); color: var(--accent); }

.vt-empty { font-size: 13px; color: var(--text-muted); font-style: italic; padding: 20px; }

/* ── Video Template — dynamic duration + global assets ──────────────────────── */
.vt-dynamic-badge {
  display: inline-block;
  background: rgba(0,191,165,.15); color: #00bfa5;
  border-radius: 4px; padding: 1px 6px;
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em;
}
.vt-field-section-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px; margin-bottom: 2px;
}

/* Global assets section */
.vt-global-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.vt-global-header {
  padding: 14px 18px;
  background: rgba(108,99,255,.06);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.vt-global-title {
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.vt-global-hint {
  font-size: 11px; font-weight: 400; color: var(--text-muted);
}
.vt-global-add { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.vt-global-empty {
  padding: 20px 18px;
  font-size: 12px; color: var(--text-muted); font-style: italic;
}
.vt-global-card { border-radius: 0; border-left: none; border-right: none; border-top: none; }
.vt-global-card:last-child { border-bottom: none; }

.vt-layer-badge {
  display: inline-block;
  background: rgba(255,107,53,.12); color: #ff6b35;
  border-radius: 4px; padding: 1px 5px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; margin-right: 4px;
}

/* ── Template JSON editor ───────────────────────────────────────────────────── */
.vt-save-btn { margin-left: auto; padding: 6px 16px; font-size: 12px; }
.vt-json-error {
  background: rgba(239,83,80,.12); border: 1px solid #ef5350;
  color: #ef5350; border-radius: 6px; padding: 8px 12px;
  font-size: 12px; font-family: var(--mono, monospace);
}
.vt-json-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
}

/* CodeMirror wrapper — fills remaining height */
.vt-cm-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.vt-cm-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: color-mix(in oklch, var(--card-bg) 80%, black);
  border-bottom: 1px solid var(--border);
}
.vt-cm-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text-secondary);
  cursor: pointer; transition: background .15s, color .15s;
}
.vt-cm-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.vt-cm-hint { font-size: 10px; color: var(--text-dim); margin-left: 4px; }

#vt-json-cm { flex: 1; min-height: 0; }
#vt-json-cm .CodeMirror {
  height: 100%;
  font-family: var(--mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
  font-size: 12px;
  line-height: 1.6;
  border-radius: 0;
  background: oklch(0.09 0.005 27);
}
#vt-json-cm .CodeMirror-scroll { min-height: 300px; }
#vt-json-cm .CodeMirror-gutters { background: oklch(0.09 0.005 27); border-right: 1px solid var(--border); }

/* Slot reference — now a proper panel section */
.vt-slot-ref {
  background: transparent;
  border-top: 1px solid var(--border);
  padding: 10px 12px 14px;
  overflow-y: auto;
  max-height: 220px;
}
.vt-slot-ref-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-dim); margin-bottom: 8px;
}
.vt-slot-group-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); margin: 8px 0 3px;
}
.vt-slot-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 6px; border-radius: 4px; cursor: pointer;
  transition: background .12s;
}
.vt-slot-row:hover { background: rgba(255,255,255,.04); }
.vt-slot-code {
  font-family: var(--mono, monospace);
  font-size: 10px; color: var(--accent);
  background: none; padding: 0; word-break: break-all; flex-shrink: 0;
}
.vt-slot-desc { font-size: 10px; color: var(--text-muted); }

/* ── Visual preview panel — dark stage ───────────────────────────────────────── */
.vt-preview-panel,
.vt-edit-right {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: oklch(0.07 0.005 27);
}

.vtp-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

/* Section tabs — top chrome strip */
.vtm-tabs {
  display: flex;
  gap: 0;
  background: oklch(0.10 0.006 27);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.vtm-tab {
  padding: 9px 18px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  text-transform: capitalize;
  letter-spacing: .02em;
  margin-bottom: -1px;
}
.vtm-tab:hover { color: var(--text-muted); }
.vtm-tab-active { color: var(--text) !important; border-bottom-color: var(--accent) !important; }

/* Stage — dark canvas where the mockup floats */
.vtm-mockup-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  min-height: 0;
}

/* Mockup frame */
.vtm-frame {
  position: relative;
  border-radius: 28px;
  border: 2px solid oklch(0.28 0.008 27);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 24px 64px rgba(0,0,0,.8),
    0 4px 16px rgba(0,0,0,.6);
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
.vtm-portrait  { width: 190px; height: 338px; border-radius: 28px; }
.vtm-landscape { width: 380px; height: 214px; border-radius: 16px; }

.vtm-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.vtm-video-bg {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  background:
    repeating-linear-gradient(
      0deg, rgba(255,255,255,.015) 0px, rgba(255,255,255,.015) 1px,
      transparent 1px, transparent 24px
    ),
    repeating-linear-gradient(
      90deg, rgba(255,255,255,.015) 0px, rgba(255,255,255,.015) 1px,
      transparent 1px, transparent 24px
    ),
    #0a0a0a;
}
.vtm-video-label {
  font-size: 8px;
  color: rgba(255,255,255,.25);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.vtm-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}

/* Talking points */
.vtm-tp {
  position: absolute;
  left: 8px; right: 8px;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vtm-tp-top    { top: 14px; }
.vtm-tp-topLeft { top: 14px; right: auto; width: 65%; }

/* Captions */
.vtm-captions {
  position: absolute;
  left: 10px; right: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
}
.vtm-captions-center { top: 50%; transform: translateY(-50%); }
.vtm-captions-bottom { bottom: 30px; }

.vtm-caption-word {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
  font-family: 'Barlow', sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.vtm-caption-hl { padding: 0 3px; border-radius: 2px; }

/* CTA elements */
.vtm-logo-placeholder {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -65%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: rgba(255,255,255,.6);
}
.vtm-logo-placeholder span {
  font-size: 7px; font-weight: 800; letter-spacing: .14em;
  color: rgba(255,255,255,.35); text-transform: uppercase;
}
.vtm-cta-text {
  position: absolute;
  bottom: 38px; left: 12px; right: 12px;
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
  letter-spacing: .02em;
}

.vtm-section-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  background: rgba(0,0,0,.5);
  padding: 2px 5px;
  border-radius: 3px;
}

/* Phone chrome */
.vtm-notch {
  position: absolute;
  top: 7px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 6px;
  background: oklch(0.12 0.004 27);
  border-radius: 4px;
  z-index: 10;
}
.vtm-home-bar {
  position: absolute;
  bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 3px;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  z-index: 10;
}

/* Spec strip — bottom of preview panel */
.vtm-spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: oklch(0.10 0.006 27);
}
.vtm-spec-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.vtm-spec-card + .vtm-spec-card {
  border-left: 1px solid var(--border);
}
.vtm-spec-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  margin-bottom: 1px;
}

/* ── Wizard mode toggle ─────────────────────────────────────────────────────── */
.vt-mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-left: auto;
}
.vt-mode-btn {
  font-size: 11px; font-weight: 600;
  padding: 4px 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.vt-mode-btn.active {
  background: var(--accent);
  color: #fff;
}
.vt-mode-btn:not(.active):hover { color: var(--text); }

/* ── Wizard wrap ────────────────────────────────────────────────────────────── */
.vtw-wrap {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

/* ── Step bar ───────────────────────────────────────────────────────────────── */
.vtw-steps {
  display: flex; align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  gap: 0;
  flex-shrink: 0;
}
.vtw-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; cursor: pointer;
  min-width: 56px;
}
.vtw-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, border-color .2s;
}
.vtw-step-label {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  transition: color .2s;
}
.vtw-step-idle .vtw-step-num {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text-dim);
}
.vtw-step-idle .vtw-step-label { color: var(--text-dim); }
.vtw-step-active .vtw-step-num {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.vtw-step-active .vtw-step-label { color: var(--text); }
.vtw-step-done .vtw-step-num {
  background: oklch(0.38 0.08 145); color: #fff; border: 1px solid oklch(0.38 0.08 145);
  font-size: 13px;
}
.vtw-step-done .vtw-step-label { color: var(--text-secondary); }
.vtw-step:hover .vtw-step-num { opacity: .8; }

.vtw-step-line {
  flex: 1; height: 1px;
  background: var(--border); margin: 0 2px; margin-bottom: 14px;
  transition: background .2s;
}
.vtw-step-line-done { background: oklch(0.38 0.08 145); }

/* ── Step body ──────────────────────────────────────────────────────────────── */
.vtw-body {
  flex: 1; overflow-y: auto;
  padding: 0;
}

.vtw-step-content {
  padding: 20px 20px 10px;
}

.vtw-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.vtw-hint-text {
  font-size: 12px; color: var(--text-dim);
  margin: -6px 0 14px; line-height: 1.5;
}

/* ── Nav bar ────────────────────────────────────────────────────────────────── */
.vtw-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.vtw-btn-back {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 14px; cursor: pointer;
  transition: background .15s, color .15s;
}
.vtw-btn-back:hover { background: rgba(255,255,255,.05); color: var(--text); }
.vtw-btn-next {
  font-size: 12px; font-weight: 700;
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px; padding: 7px 18px; cursor: pointer;
  transition: opacity .15s;
}
.vtw-btn-next:hover { opacity: .85; }
.vtw-btn-save {
  font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 7px 18px; cursor: pointer;
}

/* ── Step 1: Format cards ───────────────────────────────────────────────────── */
.vtw-format-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 6px;
}
.vtw-format-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px;
  background: oklch(0.12 0.005 27);
  border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.vtw-format-card:hover { border-color: var(--text-dim); }
.vtw-format-card.active { border-color: var(--accent); background: oklch(0.14 0.02 27); }
.vtw-format-icon { color: var(--text-secondary); line-height: 1; }
.vtw-format-card.active .vtw-format-icon { color: var(--accent); }
.vtw-format-label { font-size: 13px; font-weight: 700; color: var(--text); }
.vtw-format-sub { font-size: 10px; color: var(--text-dim); text-align: center; }

/* ── Fields ─────────────────────────────────────────────────────────────────── */
.vtw-field-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 10px;
}
.vtw-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  min-width: 90px; padding-top: 5px;
  flex-shrink: 0;
}
.vtw-input-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.vtw-input {
  width: 100%; padding: 5px 9px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 12px; font-family: inherit;
  transition: border-color .15s;
  box-sizing: border-box;
}
.vtw-input:focus { outline: none; border-color: var(--accent); }
.vtw-input-sm { max-width: 120px; }
.vtw-input-lg { width: 80px; font-size: 22px; font-weight: 700; text-align: center; padding: 8px; }
.vtw-input-hint { font-size: 10px; color: var(--text-dim); }
.vtw-select {
  padding: 5px 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 12px; font-family: inherit;
  cursor: pointer;
}
.vtw-select:focus { outline: none; border-color: var(--accent); }

/* ── Step 2: Sections ───────────────────────────────────────────────────────── */
.vtw-sections-grid {
  display: flex; flex-direction: column; gap: 8px;
}
.vtw-sec-card {
  background: oklch(0.12 0.005 27);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.vtw-sec-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.vtw-sec-icon { font-size: 14px; line-height: 1; }
.vtw-sec-name { font-size: 13px; font-weight: 700; flex: 1; }
.vtw-sec-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; background: rgba(255,255,255,.07);
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em;
}
.vtw-sec-desc {
  font-size: 11px; color: var(--text-dim);
  margin: 0; line-height: 1.4;
}
.vtw-inline-slot {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: rgba(108,99,255,.15); color: #a490ff;
}
.vtw-cta-toggle {
  display: flex; gap: 4px; margin-left: auto;
}
.vtw-pill {
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: 100px; border: 1px solid var(--border);
  background: none; color: var(--text-dim); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.vtw-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Step 3: Elements ───────────────────────────────────────────────────────── */
.vtw-elements-layout {
  display: grid; grid-template-columns: 1fr; gap: 0;
}

.vtw-el-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.vtw-el-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.vtw-el-row:hover { background: rgba(255,255,255,.04); }
.vtw-el-row.vtw-el-selected { background: rgba(108,99,255,.1); border-color: var(--accent); }
.vtw-el-icon {
  font-size: 14px; line-height: 1; color: var(--text-secondary);
  width: 20px; text-align: center;
}
.vtw-el-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.vtw-el-name { font-size: 12px; font-weight: 600; }
.vtw-el-secs { font-size: 10px; color: var(--text-dim); }
.vtw-el-checks { display: flex; gap: 6px; }
.vtw-sec-check {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 9px; font-weight: 700;
  color: var(--text-dim); cursor: pointer;
}
.vtw-sec-check input { width: 12px; height: 12px; accent-color: var(--accent); cursor: pointer; }
.vtw-el-pos {
  color: var(--text-dim); cursor: grab; padding: 4px;
  border-radius: 4px; transition: color .15s;
}
.vtw-el-pos:hover { color: var(--accent); }
.vtw-el-pos:active { cursor: grabbing; }

/* Element style panel */
.vtw-el-style-panel {
  background: oklch(0.11 0.005 27);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.vtw-el-style-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-dim);
  margin-bottom: 10px;
}

/* Snap zone mockup */
.vtw-el-snap-hint {
  padding: 0 16px 16px;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.vtw-el-snap-hint > span {
  font-size: 10px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .06em;
}

.vtm-zone-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.vtm-frame-interactive { cursor: default; }
.vtm-screen-dim { background: oklch(0.08 0.005 27) !important; }
.vtm-zone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  position: absolute; inset: 8px;
  gap: 4px;
}
.vtm-zone {
  border: 1px dashed rgba(255,255,255,.12); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
  cursor: default;
}
.vtm-zone:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.3); }
.vtm-zone.vtm-zone-occupied {
  background: rgba(108,99,255,.18); border-color: var(--accent);
}
.vtm-zone-ghost {
  font-size: 8px; font-weight: 800; letter-spacing: .05em;
  color: rgba(255,255,255,.2);
}
.vtm-zone-el { font-size: 13px; }
.vtm-zone-tabs {
  display: flex; gap: 0;
}

/* ── Step 4: Timing ─────────────────────────────────────────────────────────── */
.vtw-timing-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 8px;
}
.vtw-timing-card {
  background: oklch(0.12 0.005 27);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.vtw-timing-icon { font-size: 20px; margin-bottom: 4px; }
.vtw-timing-label { font-size: 13px; font-weight: 700; }
.vtw-timing-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.vtw-timing-input-wrap { display: flex; align-items: baseline; gap: 6px; }
.vtw-timing-unit { font-size: 12px; color: var(--text-dim); font-weight: 600; }

/* ── Step 5: Review ─────────────────────────────────────────────────────────── */
.vtw-review-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.vtw-review-table tr + tr td { border-top: 1px solid var(--border); }
.vtw-review-key {
  color: var(--text-secondary); font-weight: 600;
  padding: 7px 10px 7px 0;
  width: 120px; vertical-align: top;
}
.vtw-review-val {
  color: var(--text); padding: 7px 0;
  line-height: 1.4;
}

/* ── Agent card — run controls ──────────────────────────────────────────────── */
.acp-btn-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 2px;
}

.acp-run-btn {
  font-size: 11px; font-weight: 700;
  padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--accent); color: var(--accent);
  background: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.acp-run-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.acp-run-btn:disabled { opacity: .55; cursor: not-allowed; }

.acp-run-btn-running {
  border-color: #f5a623; color: #f5a623;
  animation: acp-pulse-border 1.2s ease-in-out infinite;
}
.acp-run-btn-success { border-color: #00bfa5 !important; color: #00bfa5 !important; }
.acp-run-btn-error   { border-color: #ef5350 !important; color: #ef5350 !important; }

@keyframes acp-pulse-border {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* Exec info button (ⓘ) */
.acp-exec-info-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity .15s, color .15s;
}
.acp-exec-info-btn:hover { opacity: 1; color: var(--accent); }

/* Execution info popover */
.acp-exec-popover {
  position: absolute;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  width: 320px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 0.78rem;
  pointer-events: none;
}
.acp-pop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}
.acp-pop-status { flex: 1; }
.acp-pop-dur    { color: var(--text-dim); font-size: 0.72rem; }
.acp-pop-id     { color: var(--text-dim); font-size: 0.68rem; font-family: monospace; }
.acp-pop-error  {
  background: #ef535018;
  border: 1px solid #ef535044;
  border-radius: 4px;
  padding: 6px 8px;
  color: #ef5350;
  font-size: 0.75rem;
  word-break: break-all;
  margin-bottom: 6px;
}
.acp-pop-output {
  background: #0002;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  color: var(--text-dim);
}
.acp-pop-empty { color: var(--text-dim); font-size: 0.75rem; }

/* New execution row highlight */
.acp-exec-new {
  animation: acp-exec-flash 2s ease forwards;
}
@keyframes acp-exec-flash {
  0%   { background: rgba(108,99,255,.25); border-radius: 4px; }
  100% { background: transparent; }
}

/* ── Live indicator ──────────────────────────────────────────────────────────── */
.sidebar-logo { position: relative; }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  margin-left: 6px; vertical-align: middle;
  transition: background .4s;
}
.live-live          { background: #00bfa5; box-shadow: 0 0 0 2px rgba(0,191,165,.25); animation: live-pulse 2.5s ease-in-out infinite; }
.live-reconnecting  { background: #f5a623; }
.live-offline       { background: #ef5350; }

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(0,191,165,.25); }
  50%       { box-shadow: 0 0 0 5px rgba(0,191,165,.08); }
}

/* ── Live toast notification ─────────────────────────────────────────────────── */
.live-toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 8px 32px oklch(0 0 0 / 0.4);
  transform: translateY(20px); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  max-width: 320px;
}
.live-toast-show { transform: translateY(0); opacity: 1; }
.live-toast-info  {
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  border-color: color-mix(in oklch, var(--accent) 30%, var(--border));
}
.live-toast-error {
  background: color-mix(in oklch, oklch(0.55 0.22 25) 10%, var(--surface));
  border-color: color-mix(in oklch, oklch(0.55 0.22 25) 30%, var(--border));
}

/* ── Sidebar quota widget ────────────────────────────────────────────────────── */
.sidebar-quota {
  margin: 0 12px 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
}
.quota-label {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  margin-bottom: 6px;
}
.quota-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.quota-svc { color: var(--text-secondary); font-weight: 600; }
.quota-val { font-family: monospace; font-size: 10px; color: var(--text-muted); }

.quota-bar-track {
  height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width .4s ease;
}
.quota-bar-ok   { background: #00bfa5; }
.quota-bar-warn { background: #f5a623; }
.quota-bar-full { background: #ef5350; }
