/* ============================================================================
   THETIHA MUSE AI v3 — BRIGHT DAYLIGHT PROFESSIONAL EDITION
   Inspired by Claude.ai, OpenAI Codex, Antigravity IDE, and TheTiHa Muse AI
   ============================================================================ */

:root {
  --bg-app: #F7F7F5;
  --bg-rail: #FFFFFF;
  --bg-sidebar: #F2F3F0;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-hover: #F1F5F9;
  --bg-input: #FFFFFF;

  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #4F46E5;

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;

  --accent-indigo: #4F46E5;
  --accent-indigo-hover: #4338CA;
  --accent-terracotta: #D97757;
  --accent-emerald: #059669;
  --accent-amber: #D97706;
  --accent-rose: #E11D48;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.14);

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

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html, body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Explicit Native Select & Option Fix (Never White-on-White!) */
select, option {
  background-color: #FFFFFF !important;
  color: #0F172A !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.text-indigo { color: var(--accent-indigo) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-terracotta { color: var(--accent-terracotta) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-rose { color: var(--accent-rose) !important; }

/* ============================================================================
   LIVE STATUS DOTS, SPINNERS & PILL BADGES
   ============================================================================ */
.live-dot {
  display: inline-block;
  width: 8.5px;
  height: 8.5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-dot.sm {
  width: 7px;
  height: 7px;
}

.live-dot.ready {
  background-color: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: pulseEmerald 2s infinite;
}

.live-dot.busy {
  background-color: #F59E0B;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55);
  animation: pulseAmber 1.2s infinite;
}

.live-dot.danger {
  background-color: #E11D48;
}

.live-dot.idle {
  background-color: #94A3B8;
}

@keyframes pulseEmerald {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.spinner-ring {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(79, 70, 229, 0.22);
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  animation: spinRing 0.75s linear infinite;
  flex-shrink: 0;
}

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

.pill-badge, .micro-pill, .kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8.5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill-badge.emerald, .micro-pill.emerald, .kpi-badge.emerald {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}

.pill-badge.indigo, .micro-pill.violet, .micro-pill.cyan, .kpi-badge.indigo {
  background: #EEF2FF;
  color: #4338CA;
  border-color: #C7D2FE;
}

.pill-badge.terracotta {
  background: #FFF7ED;
  color: #C2410C;
  border-color: #FDBA74;
}

.pill-badge.amber, .micro-pill.amber {
  background: #FFFBEB;
  color: #B45309;
  border-color: #FDE68A;
}

.pill-badge.rose, .micro-pill.rose {
  background: #FFF1F2;
  color: #BE123C;
  border-color: #FECDD3;
}

.pill-badge.slate, .micro-pill.slate, .kpi-badge.slate {
  background: #F1F5F9;
  color: #475569;
  border-color: #E2E8F0;
}

/* ============================================================================
   APP SHELL & 5-VIEW LEFT NAVIGATION RAIL
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 78px 1fr;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.nav-rail {
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 8px;
  user-select: none;
  z-index: 30;
}

.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-indigo);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.rail-brand-text {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.rail-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.rail-btn {
  position: relative;
  width: 100%;
  padding: 9px 4px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.rail-btn.active {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: var(--accent-indigo);
}

.rail-svg {
  width: 19px;
  height: 19px;
}

.rail-label {
  font-size: 10.5px;
  font-weight: 600;
}

.rail-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  background: var(--accent-indigo);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
}

.rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.rail-status-text {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.rail-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rail-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ============================================================================
   VIEWPORT & PAGE CONTAINERS
   ============================================================================ */
.viewport-area {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

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

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

.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 48px;
}

.page-container {
  max-width: 1340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.25px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================================
   BUTTONS & INPUT CONTROLS (DAYLIGHT PRO)
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

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

.btn-block {
  width: 100%;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: var(--radius-xs);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--accent-indigo);
  color: #FFFFFF;
  border-color: var(--accent-indigo-hover);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-indigo-hover);
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #FFFFFF;
  border-color: #047857;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.22);
}
.btn-emerald:hover:not(:disabled) {
  background: #047857;
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-danger-soft {
  background: #FFF1F2;
  color: #BE123C;
  border-color: #FECDD3;
}
.btn-danger-soft:hover:not(:disabled) {
  background: #FFE4E6;
}

.btn-icon-only {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
}
.btn-icon-only:hover {
  color: var(--text-primary);
}

.clean-select, .clean-select-sm, .clean-select-xs,
.clean-input, .clean-input-num, .clean-input-xs,
.clean-textarea, .clean-search-input {
  background-color: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.clean-select:focus, .clean-select-sm:focus, .clean-select-xs:focus,
.clean-input:focus, .clean-textarea:focus, .clean-search-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.clean-select-sm { padding: 5px 9px; font-size: 12px; }
.clean-select-xs { padding: 3px 7px; font-size: 11.5px; }
.clean-input-num { width: 58px; text-align: center; padding: 4px 6px; }
.clean-input-xs { width: 48px; text-align: center; padding: 2px 4px; font-size: 11.5px; }
.clean-search-input { min-width: 270px; }

/* ============================================================================
   VIEW 1: STUDIO WORKSPACE (CLAUDE / CODEX LAYOUT WITH SESSION SIDEBAR)
   ============================================================================ */
.studio-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.studio-sessions-sidebar {
  width: 275px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.sidebar-top-action {
  padding: 14px 14px 10px;
}

.sidebar-section-label {
  padding: 4px 16px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.session-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.session-item-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.13s ease;
}

.session-item-card:hover {
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--border-subtle);
}

.session-item-card.active {
  background: #FFFFFF;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.session-item-info {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-delete-session {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.13s ease;
}

.session-item-card:hover .btn-delete-session {
  opacity: 1;
}

.btn-delete-session:hover {
  background: #FFE4E6;
  color: var(--accent-rose);
}

/* Studio Center Column */
.studio-center-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

.studio-topbar {
  height: 54px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-session-heading {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: var(--shadow-xs);
}

.svg-inline {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
}

/* Chat Transcript Area */
.chat-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.empty-state-box {
  margin: auto;
  max-width: 580px;
  text-align: center;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Chat Turn Cards (Claude / Antigravity Daylight Style) */
.turn-card {
  border-radius: var(--radius-md);
  padding: 15px 18px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}

.turn-card.role-user {
  background: #F1F5F9;
  border-color: #CBD5E1;
  align-self: flex-end;
  max-width: 84%;
  width: fit-content;
  min-width: 260px;
}

.turn-card.role-assistant {
  background: #FFFFFF;
  border-color: var(--border-subtle);
  align-self: flex-start;
  width: 100%;
}

.turn-card.role-system_handoff {
  background: #FFF7ED;
  border: 1px solid #FDBA74;
  border-left: 4px solid var(--accent-terracotta);
  width: 100%;
}

.turn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.turn-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.turn-content {
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.turn-card.role-system_handoff .turn-content {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #9A3412;
  max-height: 180px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #FFEDD5;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
}

/* Inline Media Assets Grid inside Turn */
.turn-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.inline-media-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.inline-media-card:hover {
  box-shadow: var(--shadow-md);
}

.inline-media-preview {
  width: 100%;
  height: 155px;
  background: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.inline-media-preview img, .inline-media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inline-media-meta {
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline-media-prompt {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inline-media-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.media-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Streamlined Claude/ChatGPT/Muse.ai Omni-Composer */
.composer-outer-wrap {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 16px;
}

.composer-card {
  background: #FFFFFF;
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  padding: 12px 14px 10px;
  box-shadow: 0 6px 24px -6px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.composer-card:focus-within,
.composer-card.drag-over {
  border-color: var(--accent-indigo);
  box-shadow: 0 8px 28px -6px rgba(79, 70, 229, 0.14), 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* Reference Image Attachment Tray inside Composer */
.composer-ref-tray {
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ref-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.ref-tray-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--accent-indigo);
}

.btn-link-xs {
  background: none;
  border: none;
  color: var(--accent-indigo);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link-xs:hover {
  color: var(--accent-indigo-hover);
}

.composer-ref-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ref-thumb-card {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 9px;
  border: 1.5px solid #C7D2FE;
  overflow: hidden;
  background: #0F172A;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.ref-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ref-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.82);
  color: #FFFFFF;
  border: none;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease;
}
.ref-thumb-remove:hover {
  background: var(--accent-rose);
}

/* Seamless Textarea */
.composer-input-area {
  width: 100%;
}

.composer-textarea {
  width: 100%;
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 2px 4px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 140px;
}

.composer-textarea::placeholder {
  color: #94A3B8;
}

/* Single-Line Compact Footer Toolbar */
.composer-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #F1F5F9;
  flex-wrap: wrap;
}

.composer-tools-left,
.composer-tools-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.btn-composer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EEF2FF;
  color: var(--accent-indigo);
  border: 1px solid #C7D2FE;
  border-radius: 999px;
  padding: 5px 11px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-composer-pill:hover {
  background: #E0E7FF;
  border-color: #A5B4FC;
}

.ref-count-pill {
  background: var(--accent-indigo);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 99px;
}

.mode-segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
}

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

.seg-btn.active {
  background: #FFFFFF;
  color: var(--accent-indigo);
  box-shadow: var(--shadow-xs);
}

.composer-inline-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px 8px;
}

.count-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.num-stepper {
  display: inline-flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
}

.step-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 20px;
  height: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.num-stepper .clean-input-num {
  width: 30px;
  border: none;
  padding: 1px 0;
  font-size: 11.5px;
  font-weight: 700;
  background: transparent;
}

.btn-send-dock {
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 6px 15px;
}

/* Reference Images inside User Turn Bubble */
.turn-ref-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.turn-ref-item {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #C7D2FE;
  background: #0F172A;
  cursor: pointer;
  position: relative;
}

.turn-ref-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-chip:hover {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: var(--accent-indigo);
}

/* Collapsible Studio Side Drawer */
.studio-side-drawer {
  width: 315px;
  background: #FFFFFF;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.drawer-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
}

.drawer-media-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================================
   VIEW 2: MULTI-THREAD ACCOUNT COCKPIT & 9ROUTER
   ============================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-foot {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.kpi-router-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.threshold-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Multi-Thread Control Bar */
.multithread-bar {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mt-left, .mt-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.concurrency-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.live-progress-banner {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-indigo);
}

.progress-banner-track {
  flex: 1;
  max-width: 360px;
  height: 8px;
  background: #E0E7FF;
  border-radius: 99px;
  overflow: hidden;
}

.progress-banner-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-emerald));
  transition: width 0.25s ease;
}

.accounts-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow-xs);
}

.filter-pills-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill, .filter-chip {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s ease;
}

.filter-pill.active, .filter-chip.active {
  background: #EEF2FF;
  color: var(--accent-indigo);
  border-color: #C7D2FE;
}

/* Account Table Rows */
.account-list-header {
  display: grid;
  grid-template-columns: 2.2fr 2.3fr 1.4fr 1.6fr;
  gap: 14px;
  padding: 0 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

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

.account-row-card {
  display: grid;
  grid-template-columns: 2.2fr 2.3fr 1.4fr 1.6fr;
  gap: 14px;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
  transition: all 0.14s ease;
}

.account-row-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.account-row-card.active-candidate {
  border-left: 4px solid var(--accent-emerald);
}

.account-row-card.pinned-account {
  border-left: 4px solid var(--accent-indigo);
}

.acc-col-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.acc-title-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.acc-email-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.acc-error-sub {
  font-size: 11px;
  color: var(--accent-rose);
  margin-top: 2px;
}

.acc-working-sub {
  font-size: 11px;
  color: var(--accent-indigo);
  font-weight: 600;
  margin-top: 2px;
}

.btn-copy-inline {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
}
.btn-copy-inline:hover {
  color: var(--accent-indigo);
}

.acc-col-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.acc-col-quota {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quota-top-line {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.quota-bar-track {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-indigo));
  border-radius: 99px;
}

.quota-bar-fill.warn {
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-rose));
}

.acc-col-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.icon-act-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
}

.icon-act-btn:hover {
  background: #EEF2FF;
  color: var(--accent-indigo);
  border-color: #C7D2FE;
}

.icon-act-btn.danger:hover {
  background: #FFF1F2;
  color: var(--accent-rose);
  border-color: #FECDD3;
}

.rotation-log-panel {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rotation-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
}

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

.rotation-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-terracotta);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ============================================================================
   VIEW 3: MEDIA GALLERY & FULL-SCREEN LIGHTBOX
   ============================================================================ */
.media-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 16px;
}

.gallery-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card:hover {
  box-shadow: var(--shadow-md);
}

.gallery-card-thumb {
  height: 195px;
  background: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.gallery-card-thumb img, .gallery-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-select-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-xs);
}

.gallery-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Lightbox Modal */
.lightbox-modal-card {
  width: 92vw;
  max-width: 1220px;
  height: 84vh;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 360px;
  overflow: hidden;
}

.lightbox-stage {
  background: #090D16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
}

.lightbox-stage img, .lightbox-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-sidebar {
  background: #FFFFFF;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.lightbox-meta-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
}

.lightbox-footer .btn {
  flex: 1;
}

/* ============================================================================
   VIEW 4 & VIEW 5: CONTEXT COMPACTOR & AGENT API BRIDGE
   ============================================================================ */
.context-api-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.surface-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.surface-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.surface-title {
  font-size: 15px;
  font-weight: 700;
}

.surface-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.handoff-metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.mini-metric {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mini-metric span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.handoff-action-box {
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 10px;
}

.handoff-summary-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.summary-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-indigo);
  margin-bottom: 4px;
}

.summary-list {
  list-style: inside disc;
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.code-box-wrap {
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.code-box-header {
  background: var(--bg-subtle);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.code-pre {
  padding: 14px;
  font-size: 11.5px;
  color: #F8FAFC;
  background: #0F172A;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: var(--radius-xs);
}

.api-tester-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

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

.snippet-tabs {
  display: flex;
  gap: 6px;
}

.snippet-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 6px;
}

.snippet-tab.active {
  background: #EEF2FF;
  color: var(--accent-indigo);
}

.api-logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 560px;
  overflow-y: auto;
}

.api-log-row {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-indigo);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

/* ============================================================================
   MODALS & TOASTS
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 680px;
}

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

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

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

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
}

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

.modal-footer {
  padding: 12px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.detail-kv-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 12px;
  font-size: 12.5px;
}

.detail-kv-label {
  color: var(--text-muted);
  font-weight: 600;
}

.detail-kv-val {
  color: var(--text-primary);
  word-break: break-all;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-indigo);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  font-weight: 500;
  max-width: 390px;
}
.toast.toast-success { border-left-color: var(--accent-emerald); }
.toast.toast-warn { border-left-color: var(--accent-amber); }
.toast.toast-error { border-left-color: var(--accent-rose); }

/* ============================================================================
   CLAUDE-STYLE MINIMALIST MUSE AVATAR & REASONING TIMER
   ============================================================================ */
@keyframes turnSlideIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.turn-card.optimistic-turn {
  animation: turnSlideIn 0.14s ease-out;
}

.muse-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #EAE9E4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.muse-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.muse-author-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

/* Minimalist Claude-style Thinking Row (Official Muse Mascot Avatar + Reasoning Time Only) */
.muse-claude-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  align-self: flex-start;
  animation: turnSlideIn 0.15s ease-out;
  user-select: none;
}

.muse-avatar-thinking {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1.5px solid #E2E1DC;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.35);
  animation: museAvatarPulse 1.6s infinite cubic-bezier(0.66, 0, 0, 1);
  flex-shrink: 0;
}

/* Suppress IDM Floating Overlay Only */
[id*="idm" i],
[class*="idm" i],
div[style*="2147483647"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes museSparkleSpin {
  0% {
    transform: rotate(0deg) scale(0.95);
  }
  50% {
    transform: rotate(180deg) scale(1.12);
  }
  100% {
    transform: rotate(360deg) scale(0.95);
  }
}

@keyframes museAvatarPulse {
  to {
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0);
  }
}

.muse-thinking-label {
  font-size: 13.5px;
  font-weight: 500;
  background: linear-gradient(90deg, #475569 0%, #4F46E5 50%, #475569 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: claudeTextShimmer 2s linear infinite;
}

@keyframes claudeTextShimmer {
  to {
    background-position: 200% center;
  }
}

.muse-thinking-time {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================================
   ANTIGRAVITY / CLAUDE GROUPED PROJECT & SESSION TREE SIDEBAR
   ============================================================================ */
.studio-sessions-sidebar {
  width: 268px;
  background: #F8F8F6;
  border-right: 1px solid #EAE9E4;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  position: relative;
  user-select: none;
}

.ag-sidebar-top-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 10px 10px;
  border-bottom: 1px solid #EAE9E4;
}

.ag-top-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #3F3E3A;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.ag-top-nav-item:hover {
  background: #EFEFE9;
  color: #18181B;
}

.ag-plus-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #EAE9E3;
  color: #52514C;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ag-nav-icon {
  width: 20px;
  height: 20px;
  color: #52514C;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ag-project-tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ag-proj-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ag-proj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px 3px 8px;
  border-radius: 6px;
  min-height: 26px;
}

.ag-proj-title-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 0;
  color: #8E8D86;
  font-size: 12.8px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 175px;
  transition: color 0.14s ease;
}

.ag-proj-title-btn:hover {
  color: #3F3E3A;
}

.ag-proj-chevron {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  transition: transform 0.16s ease;
  flex-shrink: 0;
}

.ag-proj-group.collapsed .ag-proj-chevron {
  transform: rotate(-90deg);
}

.ag-proj-group.collapsed .ag-sess-list {
  display: none;
}

.ag-proj-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ag-proj-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #6E6D66;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.14s ease, color 0.14s ease;
}

.ag-proj-icon-btn:hover {
  background: #EAE9E3;
  color: #18181B;
}

.ag-sess-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-sess-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6.5px 8px 6.5px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #3F3E3A;
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.12s ease, color 0.12s ease;
  position: relative;
}

.ag-sess-row:hover {
  background: #F0EFEA;
  color: #18181B;
}

.ag-sess-row.active {
  background: #EBEAE4;
  color: #18181B;
  font-weight: 500;
}

.ag-sess-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  border: 1.4px solid #A8A79F;
  background: transparent;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.ag-sess-row.active .ag-sess-dot {
  border-color: #3F3E3A;
  background: #3F3E3A;
}

.ag-sess-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.ag-sess-del {
  opacity: 0;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #8E8D86;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.ag-sess-row:hover .ag-sess-del {
  opacity: 1;
}

.ag-sess-del:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* Popover Menu for Project Sliders (🎛️) / Customize */
.ag-project-popover {
  position: absolute;
  top: 86px;
  left: 10px;
  right: 10px;
  background: #FFFFFF;
  border: 1px solid #E2E1DC;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-popover-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 2px 8px;
}

.ag-popover-title {
  font-size: 13px;
  font-weight: 700;
  color: #18181B;
}

.ag-popover-folder {
  font-size: 11px;
  color: #4F46E5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-popover-stats {
  font-size: 11px;
  color: #71717A;
  padding: 0 8px 4px 8px;
}

.ag-popover-divider {
  height: 1px;
  background: #F1F0EC;
  margin: 4px 2px;
}

.ag-popover-item {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6.5px 8px;
  font-size: 12.2px;
  font-weight: 500;
  color: #27272A;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s ease;
}

.ag-popover-item:hover {
  background: #F4F4F0;
}

.ag-popover-item.danger-soft {
  color: #B45309;
}
.ag-popover-item.danger-soft:hover {
  background: #FEF3C7;
}

.ag-popover-item.danger {
  color: #DC2626;
}
.ag-popover-item.danger:hover {
  background: #FEE2E2;
}

/* ============================================================================
   MUSE AI ENTERPRISE COCKPIT CARD GRID (`VIEW-ACCOUNTS`)
   Purpose-built for Meta Muse AI (Hatch Cloud VM, 1B/31B Token Pool, Image/Video Render)
   ============================================================================ */
.auto-refresh-control-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  box-shadow: var(--shadow-xs);
}

.auto-domain-detect-box {
  margin-top: 7px;
  padding: 8px 12px;
  background: #F0FDF4;
  color: #065F46;
  border: 1px solid #A7F3D0;
  border-radius: 8px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cockpit-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(385px, 1fr));
  gap: 16px;
  margin-top: 6px;
}

@keyframes museCardShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes museDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

.muse-cockpit-card {
  background: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 15px 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 10px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s ease;
  position: relative;
  overflow: hidden;
}

.muse-cockpit-card:hover {
  transform: translateY(-2px);
  border-color: #CBD5E1;
  box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.09), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
}

.muse-cockpit-card.active-candidate {
  border-color: #10B981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2), 0 8px 20px -4px rgba(16, 185, 129, 0.1);
}

.muse-cockpit-card.active-candidate::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10B981, #059669);
}

.muse-cockpit-card.tier-31b {
  border-color: #818CF8;
  background: linear-gradient(180deg, #F5F7FF 0%, #FFFFFF 36%);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 8px 22px -4px rgba(79, 70, 229, 0.1);
}

.muse-cockpit-card.tier-31b::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4F46E5, #06B6D4, #10B981);
}

.muse-cockpit-card.out-of-pool {
  opacity: 0.68;
  background: #F8FAFC;
  border-style: dashed;
}

/* Row 1: Checkbox + Live Dot + Email + Muse Tier Badge */
.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mc-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.mc-identity input.acc-row-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-indigo);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
}

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

.mc-status-dot.online {
  background: #10B981;
  animation: museDotPulse 2.4s infinite ease-in-out;
}

.mc-status-dot.idle {
  background: #F59E0B;
}

.mc-status-dot.danger {
  background: #EF4444;
}

.mc-email {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-copy-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 3px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.14s ease, background 0.14s ease;
}
.mc-copy-btn:hover {
  color: var(--accent-indigo);
  background: #EEF2FF;
}

.mc-badges-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.mc-tier-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mc-tier-badge.muse-31b {
  background: linear-gradient(135deg, #4F46E5 0%, #0D9488 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.mc-tier-badge.muse-1b {
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
}

.mc-tier-badge.muse-free {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}

.mc-active-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

/* Row 2: Muse Profile Name & Router Pool Switch */
.mc-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: #64748B;
}

.mc-profile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-profile-name {
  font-weight: 600;
  color: #334155;
}

.mc-pool-toggle {
  background: #F0FDF4;
  color: #15803D;
  border: 1px solid #BBF7D0;
  border-radius: 6px;
  padding: 2.5px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.14s ease;
  flex-shrink: 0;
}
.mc-pool-toggle:hover {
  background: #DCFCE7;
  border-color: #86EFAC;
}

.mc-pool-toggle.paused {
  background: #FEF2F2;
  color: #B91C1C;
  border-color: #FECACA;
}
.mc-pool-toggle.paused:hover {
  background: #FEE2E2;
}

/* Row 3: Muse System Status Strip (Hatch VM | Saved Session | Webmail Domain) */
.mc-system-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid #F1F5F9;
}

.mc-sys-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.mc-sys-pill {
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 2.5px 7px;
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mc-sys-pill.vm-live {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}

.mc-sys-pill.sess-saved {
  background: #EEF2FF;
  color: #4338CA;
  border-color: #C7D2FE;
}

.mc-sys-pill.clickable {
  cursor: pointer;
  transition: all 0.14s ease;
}
.mc-sys-pill.clickable:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

.mc-sys-pill.otp-code-pill {
  background: #FEF3C7;
  color: #B45309;
  border-color: #FDE68A;
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Row 4: Dual Muse AI Quota Progress Bars (Additional Tokens & Weekly Free Plan) */
.mc-quota-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mc-quota-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mc-quota-card.highlight-31b {
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.7) 0%, rgba(236, 253, 245, 0.7) 100%);
  border-color: #A5B4FC;
}

.mc-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}

.mc-quota-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #334155;
}

.mc-quota-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #E0E7FF;
  color: #3730A3;
}

.mc-quota-tag.emerald {
  background: #D1FAE5;
  color: #065F46;
}

.mc-quota-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0F172A;
}

.mc-quota-right {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #64748B;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mc-pct-badge {
  color: #059669;
  font-weight: 700;
}
.mc-pct-badge.warn {
  color: #D97706;
}

.mc-bar-track {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}

.mc-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #10B981, #059669);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.mc-bar-fill.tokens-31b {
  background: linear-gradient(90deg, #4F46E5, #06B6D4, #10B981);
}

.mc-bar-fill.tokens-1b {
  background: linear-gradient(90deg, #6366F1, #10B981);
}

.mc-bar-fill.warn {
  background: linear-gradient(90deg, #F59E0B, #EF4444);
}

/* Row 5: Muse Production Telemetry Strip (Prompts / Muse Image / Muse Video) */
.mc-telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  font-size: 11px;
  color: #475569;
}

.mc-telemetry-bar.busy-shimmer {
  background: linear-gradient(90deg, #EEF2FF 25%, #E0E7FF 50%, #EEF2FF 75%);
  background-size: 200% 100%;
  animation: museCardShimmer 1.6s infinite linear;
  border-color: #A5B4FC;
  color: #3730A3;
  font-weight: 600;
}

.mc-telemetry-bar.error-state {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
}

.mc-media-counters {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.mc-counter-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #334155;
  font-weight: 600;
}

.mc-counter-item svg {
  color: #64748B;
}

/* Row 6: Footer Metadata & Action Dock */
.mc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #F1F5F9;
}

.mc-sync-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #64748B;
}

.mc-priority-select {
  background: #F8FAFC;
  color: #334155;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 2.5px 8px;
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.mc-priority-select:hover,
.mc-priority-select:focus {
  background: #FFFFFF;
  border-color: var(--accent-indigo);
}

.mc-action-dock {
  display: grid;
  grid-template-columns: 1.35fr repeat(5, 1fr);
  gap: 5px;
  margin-top: 2px;
}

.mc-dock-btn {
  height: 30px;
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.mc-dock-btn:hover {
  background: #EEF2FF;
  color: var(--accent-indigo);
  border-color: #C7D2FE;
  transform: translateY(-1px);
}

.mc-dock-btn.studio-use {
  background: #EEF2FF;
  color: #4338CA;
  border-color: #C7D2FE;
}
.mc-dock-btn.studio-use:hover {
  background: #4F46E5;
  color: #FFFFFF;
  border-color: #4F46E5;
}

.mc-dock-btn.emerald-act {
  color: #047857;
  background: #ECFDF5;
  border-color: #A7F3D0;
}
.mc-dock-btn.emerald-act:hover {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}

.mc-dock-btn.danger:hover {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

/* ============================================================================
   UIVERSE.IO ARCHITECTURAL FLOW STUDIO (`VIEW-WORKFLOW`)
   Monochrome Carbon/Titanium Design, Tactile 3D Controls, Precision Bezier Wires
   ============================================================================ */
.n8n-studio-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  max-width: 100%;
  background: #F8FAFC;
  overflow: hidden;
}

/* Single-Row Sleek Executive Topbar */
.n8n-topbar {
  height: 52px;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #E2E8F0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 30;
}

.n8n-topbar-left,
.n8n-topbar-center,
.n8n-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Uiverse Tactile Icon & Ghost Buttons */
.uiv-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.uiv-icon-btn:hover {
  border-color: #94A3B8;
  color: #0F172A;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.07);
}
.uiv-icon-btn.active {
  background: #0F172A;
  border-color: #0F172A;
  color: #FFFFFF;
}

.uiv-ghost-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: #334155;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.uiv-ghost-btn:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  color: #0F172A;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.uiv-ghost-btn:active {
  transform: translateY(0);
}

/* Sleek Workflow Selector Pill */
.n8n-flow-selector-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.n8n-flow-selector-pill:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
}
.n8n-flow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0F172A;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
}
.n8n-flow-select {
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: #0F172A;
  max-width: 190px;
  outline: none;
  cursor: pointer;
}

/* Uiverse Segmented Glass Pill Switcher */
.uiv-segmented-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #F1F5F9;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  flex-shrink: 0;
}

.n8n-tpl-chip {
  border: none;
  background: transparent;
  color: #64748B;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.n8n-tpl-chip:hover {
  color: #0F172A;
}
.n8n-tpl-chip.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Uiverse Compact Select Pill */
.uiv-select-pill {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #1E293B;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 142px;
  flex-shrink: 0;
  transition: all 0.16s ease;
}
.uiv-select-pill:hover,
.uiv-select-pill:focus {
  background: #FFFFFF;
  border-color: #94A3B8;
}

/* Uiverse 3D Tactile & Shimmer Run Button */
.uiv-run-btn {
  position: relative;
  overflow: hidden;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid #0F172A;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 2px 0 #020617,
    0 6px 16px rgba(15, 23, 42, 0.22);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.uiv-run-btn:hover {
  background: linear-gradient(180deg, #334155 0%, #0F172A 100%);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 3px 0 #020617,
    0 10px 22px rgba(15, 23, 42, 0.28);
}
.uiv-run-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 #020617,
    0 3px 8px rgba(15, 23, 42, 0.18);
}
.uiv-run-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.uiv-run-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent
  );
  transform: skewX(-20deg);
  animation: uivButtonSweep 3.4s infinite ease-in-out;
  pointer-events: none;
}

@keyframes uivButtonSweep {
  0%, 65% { left: -100%; }
  100% { left: 180%; }
}

.uiv-stop-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: #DC2626;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.uiv-stop-btn:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
}
.uiv-stop-square {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #DC2626;
}

/* Execution Progress Banner with Uiverse Wave Loader */
.n8n-exec-banner {
  height: 36px;
  min-height: 36px;
  background: #0F172A;
  border-bottom: 1px solid #1E293B;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: #F8FAFC;
}
.n8n-exec-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}
.uiv-wave-loader {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}
.uiv-wave-loader span {
  width: 3px;
  height: 100%;
  background: #38BDF8;
  border-radius: 99px;
  animation: uivWaveBar 0.9s infinite ease-in-out;
}
.uiv-wave-loader span:nth-child(2) { animation-delay: 0.15s; }
.uiv-wave-loader span:nth-child(3) { animation-delay: 0.3s; }
.uiv-wave-loader span:nth-child(4) { animation-delay: 0.45s; }

@keyframes uivWaveBar {
  0%, 100% { transform: scaleY(0.35); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

.n8n-exec-track {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
}
.n8n-exec-fill {
  height: 100%;
  background: linear-gradient(90deg, #38BDF8, #10B981);
  border-radius: 99px;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 3-Column n8n Body with Collapsible Sidebars */
.n8n-main-body {
  flex: 1;
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr) 300px;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  transition: grid-template-columns 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.n8n-main-body.hide-palette {
  grid-template-columns: 0px minmax(0, 1fr) 300px;
}
.n8n-main-body.hide-inspector {
  grid-template-columns: 206px minmax(0, 1fr) 0px;
}
.n8n-main-body.hide-palette.hide-inspector {
  grid-template-columns: 0px minmax(0, 1fr) 0px;
}

/* Left Palette Sidebar — Minimalist Monochrome Dock */
.n8n-palette-sidebar {
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 20;
}

.n8n-palette-header {
  padding: 12px 14px 10px 14px;
  border-bottom: 1px solid #F1F5F9;
}
.n8n-palette-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.01em;
}
.n8n-palette-sub {
  font-size: 11px;
  color: #64748B;
  margin-top: 2px;
}

.n8n-palette-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.n8n-palette-group-label {
  font-size: 9.8px;
  font-weight: 700;
  color: #64748B;
  letter-spacing: 0.06em;
  margin: 8px 4px 2px 4px;
}

.n8n-palette-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: grab;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.n8n-palette-item:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.n8n-palette-item:active {
  cursor: grabbing;
  transform: scale(0.98);
}

/* Monochrome Titanium/Obsidian Squircle Icon */
.n8n-node-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, #1E293B 0%, #0F172A 100%);
  color: #38BDF8;
  border: 1px solid #334155;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.n8n-palette-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.n8n-palette-meta strong {
  font-size: 11.8px;
  font-weight: 600;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.n8n-palette-meta span {
  font-size: 10.4px;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.n8n-quick-add-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.16s ease;
}
.n8n-quick-add-btn:hover {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
}

/* ============================================================================
   CENTER INTERACTIVE MIDNIGHT BLUEPRINT CANVAS (ZERO BLUR VECTOR RENDERING)
   ============================================================================ */
.n8n-canvas-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0B1120;
  background-image:
    radial-gradient(#28354E 1.25px, transparent 1.25px),
    radial-gradient(circle at 50% 42%, rgba(30, 58, 138, 0.28) 0%, rgba(11, 17, 32, 0.95) 75%);
  background-size: 22px 22px, 100% 100%;
  cursor: grab;
  user-select: none;
}
.n8n-canvas-viewport.panning {
  cursor: grabbing;
}

/* Zero-size stage with no `will-change` prevents Chromium from rasterizing a blurry bitmap! */
.n8n-canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: visible;
  transform-origin: 0 0;
}

/* Precision 1:1 SVG Wire Layer */
.n8n-edges-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}

.n8n-edge-group {
  pointer-events: stroke;
  cursor: pointer;
}

.n8n-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18px;
  pointer-events: stroke;
  cursor: pointer;
}

/* High-contrast glowing circuit wire on Midnight Blueprint */
.n8n-edge-path {
  fill: none;
  stroke: #475569;
  stroke-width: 2.2px;
  stroke-linecap: round;
  transition: stroke 0.18s ease, stroke-width 0.18s ease;
}

/* Animated cyan electric signal gliding along every wire */
.n8n-edge-signal {
  fill: none;
  stroke: #38BDF8;
  stroke-width: 2.2px;
  stroke-linecap: round;
  stroke-dasharray: 6 18;
  animation: n8nSignalGlide 1.5s linear infinite;
  opacity: 0.9;
  pointer-events: none;
}

.n8n-edge-joint {
  fill: #0B1120;
  stroke: #38BDF8;
  stroke-width: 2.2px;
  pointer-events: none;
  transition: stroke 0.18s ease, fill 0.18s ease;
}

.n8n-edge-group:hover .n8n-edge-path {
  stroke: #F43F5E;
  stroke-width: 3px;
}
.n8n-edge-group:hover .n8n-edge-signal {
  stroke: #FDA4AF;
  opacity: 1;
}
.n8n-edge-group:hover .n8n-edge-joint {
  stroke: #F43F5E;
  fill: #881337;
}

.n8n-edge-path.active-flow {
  stroke: #0EA5E9;
  stroke-width: 2.8px;
}
.n8n-edge-signal.active-flow {
  stroke: #34D399;
  stroke-width: 3px;
  stroke-dasharray: 8 12;
  opacity: 1;
  animation: n8nSignalGlide 0.5s linear infinite;
}

.n8n-edge-path.temp {
  fill: none;
  stroke: #38BDF8;
  stroke-width: 2.4px;
  stroke-dasharray: 6 6;
  animation: n8nSignalGlide 0.65s linear infinite;
  pointer-events: none;
}

@keyframes n8nSignalGlide {
  to {
    stroke-dashoffset: -24;
  }
}

.n8n-nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 10;
  pointer-events: none;
}

/* ============================================================================
   RAZOR-SHARP TITANIUM NODE CARD (SOLID VECTOR SURFACE, NO BLUR FILTER)
   ============================================================================ */
.n8n-node-card {
  position: absolute;
  width: 210px;
  background: #151F32;
  border: 1.5px solid #2E3F5E;
  border-radius: 13px;
  box-shadow:
    0 14px 28px -6px rgba(2, 6, 23, 0.65),
    0 4px 10px -2px rgba(2, 6, 23, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  cursor: grab;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  transition:
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.n8n-node-card:hover {
  background: #19253B;
  border-color: #64748B;
  box-shadow:
    0 18px 34px -6px rgba(2, 6, 23, 0.78),
    0 0 0 1px rgba(56, 189, 248, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.n8n-node-card.selected {
  background: #18243A;
  border-color: #38BDF8;
  box-shadow:
    0 0 0 3px rgba(56, 189, 248, 0.22),
    0 18px 36px -6px rgba(2, 6, 23, 0.82);
}

.n8n-node-card.status-running {
  border-color: #38BDF8;
  animation: uivNodeRunningGlow 1.4s infinite ease-in-out;
}

@keyframes uivNodeRunningGlow {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 16px 32px rgba(2, 6, 23, 0.75);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.35), 0 18px 38px rgba(16, 185, 129, 0.28);
  }
}

.n8n-node-card.status-done {
  border-color: #10B981;
}

.n8n-node-card.status-error {
  border-color: #F43F5E;
}

/* Fixed 54px Header so Ports at top: 27px NEVER shift vertically */
.n8n-node-head {
  height: 54px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #223049;
}

.n8n-node-card .n8n-node-icon {
  background: #0B1120;
  border: 1px solid #2E3F5E;
  color: #38BDF8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.n8n-node-title-wrap {
  flex: 1;
  min-width: 0;
}

.n8n-node-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}

.n8n-node-step-tag {
  font-family: var(--font-mono);
  font-size: 9.8px;
  font-weight: 700;
  color: #38BDF8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.n8n-node-title {
  font-size: 12.6px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.n8n-node-del-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94A3B8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.n8n-node-card:hover .n8n-node-del-btn,
.n8n-node-card.selected .n8n-node-del-btn {
  opacity: 1;
}
.n8n-node-del-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #FDA4AF;
}

/* Minimalist Node Footer — Single Crisp Metric Chip + Status Dot */
.n8n-node-body {
  padding: 8px 11px 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.n8n-node-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.n8n-node-metric-pill {
  flex: 1;
  min-width: 0;
  background: #0B1120;
  border: 1px solid #24324D;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uiv-node-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #475569;
  flex-shrink: 0;
  position: relative;
}
.uiv-node-status-dot.running {
  background: #38BDF8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
  animation: uivPulseDot 1s infinite ease-in-out;
}
.uiv-node-status-dot.done {
  background: #10B981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}
.uiv-node-status-dot.error {
  background: #F43F5E;
}

@keyframes uivPulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.n8n-node-media-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.n8n-node-thumb {
  width: 100%;
  height: 38px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #09090B;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.n8n-node-thumb:hover {
  transform: scale(1.06);
  border-color: #38BDF8;
  z-index: 2;
}
.n8n-node-thumb img,
.n8n-node-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================================
   PRECISION HARDWARE PORTS (LOCKED AT HEADER CENTER `top: 27px`)
   ============================================================================ */
.n8n-port {
  position: absolute;
  top: 27px;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #0B1120;
  border: 2.5px solid #38BDF8;
  box-shadow: 0 0 0 2px rgba(11, 17, 32, 0.9);
  cursor: crosshair;
  z-index: 25;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.n8n-port.port-in {
  left: -7px;
}
.n8n-port.port-out {
  right: -7px;
}
.n8n-port:hover {
  transform: translateY(-50%) scale(1.36);
  background: #38BDF8;
  border-color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.32);
}

/* ============================================================================
   FLOATING UIVERSE DARK GLASS ZOOM & LAYOUT DOCK (`.n8n-canvas-hud`)
   ============================================================================ */
.n8n-canvas-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #151F32;
  border: 1px solid #2E3F5E;
  border-radius: 12px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #F8FAFC;
  box-shadow:
    0 14px 30px -6px rgba(2, 6, 23, 0.7),
    0 2px 6px rgba(2, 6, 23, 0.4);
  z-index: 25;
}

.n8n-hud-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.n8n-hud-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid #2E3F5E;
  background: #0B1120;
  color: #F8FAFC;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.n8n-hud-btn:hover {
  background: #38BDF8;
  border-color: #38BDF8;
  color: #0B1120;
}

.n8n-zoom-slider {
  width: 78px;
  height: 4px;
  appearance: none;
  background: #334155;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
.n8n-zoom-slider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #38BDF8;
  border: 2px solid #0B1120;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.14s ease;
}
.n8n-zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.n8n-hud-zoom {
  min-width: 44px;
  height: 26px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #F8FAFC;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.n8n-hud-zoom:hover {
  background: #1E293B;
  border-color: #334155;
}

.n8n-hud-pill-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid #2E3F5E;
  background: #0B1120;
  color: #E2E8F0;
  font-family: var(--font-sans);
  font-size: 11.2px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.n8n-hud-pill-btn:hover {
  background: #38BDF8;
  border-color: #38BDF8;
  color: #0B1120;
}

.n8n-hud-sep {
  width: 1px;
  height: 16px;
  background: #2E3F5E;
}

.n8n-hud-stats {
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
  padding: 0 4px;
  white-space: nowrap;
}

/* Right Sidebar: Node Inspector & Film Storyboard */
.n8n-inspector-sidebar {
  background: #FFFFFF;
  border-left: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 20;
}

.n8n-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
  padding: 4px;
  gap: 4px;
}

.n8n-insp-tab {
  border: none;
  background: transparent;
  padding: 6px 6px;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: #64748B;
  cursor: pointer;
  transition: all 0.16s ease;
}
.n8n-insp-tab.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.n8n-insp-pane {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
}
.n8n-insp-pane.active {
  display: flex;
}

.n8n-inspector-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.n8n-storyboard-toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.n8n-storyboard-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.n8n-scene-card {
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.n8n-scene-card-head {
  padding: 7px 10px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #0F172A;
}
.n8n-scene-media {
  width: 100%;
  max-height: 185px;
  background: #09090B;
  position: relative;
  cursor: pointer;
}
.n8n-scene-media img,
.n8n-scene-media video {
  width: 100%;
  max-height: 185px;
  object-fit: cover;
  display: block;
}
.n8n-scene-foot {
  padding: 8px 10px;
  font-size: 11.2px;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.n8n-exec-logs-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.2px;
}
.n8n-log-entry {
  padding: 7px 9px;
  border-radius: 7px;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #1E293B;
  line-height: 1.4;
}
.n8n-log-entry.ok {
  border-left: 3px solid #10B981;
}
.n8n-log-entry.run {
  border-left: 3px solid #0F172A;
  background: #F1F5F9;
}
.n8n-log-entry.err {
  border-left: 3px solid #EF4444;
  background: #FEF2F2;
}

/* ============================================================================
   RESPONSIVE MOBILE & TABLET LAYOUT (375px .. 768px) — COLLAPSIBLE DRAWER & ZERO OVERFLOW
   ============================================================================ */
.mobile-only-btn {
  display: none !important;
}

.mobile-sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .mobile-only-btn {
    display: inline-flex !important;
  }

  .hide-on-xs {
    display: none !important;
  }

  .app-shell {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    overflow: hidden;
  }

  .nav-rail {
    width: 100% !important;
    height: 50px;
    min-height: 50px;
    flex-direction: row !important;
    padding: 4px 8px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    justify-content: space-between;
    gap: 6px;
    flex-shrink: 0;
  }

  .rail-brand {
    flex-direction: row;
    gap: 4px;
    flex-shrink: 0;
  }

  .rail-logo {
    width: 30px;
    height: 30px;
  }

  .rail-brand-text {
    display: none;
  }

  .rail-menu {
    flex-direction: row !important;
    gap: 4px;
    width: auto;
    flex: 1;
    overflow-x: auto;
    align-items: center;
  }

  .rail-footer {
    flex-direction: row !important;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }

  .rail-btn {
    width: auto;
    min-width: 44px;
    padding: 4px 7px;
    flex-direction: row;
    gap: 4px;
    flex-shrink: 0;
  }

  .rail-badge {
    display: none !important;
  }

  .rail-svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  .rail-label {
    font-size: 10.5px;
    white-space: nowrap;
  }

  .rail-label br {
    display: none;
  }

  .viewport-area {
    flex: 1;
    width: 100%;
    height: calc(100vh - 50px);
    overflow: hidden;
  }

  .studio-layout {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    overflow: hidden;
  }

  .studio-sessions-sidebar {
    position: fixed !important;
    top: 50px;
    left: 0;
    bottom: 0;
    width: 280px !important;
    max-width: 84vw !important;
    height: calc(100vh - 50px) !important;
    z-index: 120;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border-strong);
  }

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

  .mobile-sidebar-backdrop.mobile-open {
    display: block !important;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 110;
  }

  .studio-center-workspace {
    width: 100% !important;
    max-width: 100vw !important;
    flex: 1;
    min-width: 0;
    height: 100%;
  }

  .studio-topbar {
    height: auto;
    min-height: 46px;
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .studio-session-heading {
    font-size: 13px;
    max-width: 145px;
  }

  .topbar-left, .topbar-center, .topbar-right {
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
  }

  .chat-transcript {
    padding: 10px;
    width: 100%;
    max-width: 100%;
  }

  .empty-state-box {
    padding: 18px 14px;
    max-width: 100%;
  }

  .composer-outer-wrap {
    padding: 6px 8px 10px !important;
    width: 100%;
    max-width: 100vw;
  }

  .composer-card {
    padding: 8px 10px !important;
    width: 100%;
    max-width: 100%;
  }

  .composer-footer-bar,
  .composer-tools-left,
  .composer-tools-right {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .page-scroll {
    padding: 12px 10px 32px;
  }

  .view-header-bar,
  .accounts-toolbar,
  .gallery-toolbar {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .context-grid,
  .context-api-grid,
  .api-bridge-grid,
  .n8n-studio-shell {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto;
  }

  .turn-media-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .inline-media-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  .lightbox-modal-card {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 94vw !important;
    max-width: 94vw !important;
    height: auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  .lightbox-stage {
    min-height: 200px !important;
    max-height: 42vh !important;
    width: 100% !important;
    flex-shrink: 0 !important;
  }

  .lightbox-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    border-left: none !important;
    border-top: 1px solid var(--border-subtle) !important;
    overflow-y: visible !important;
  }

  .lightbox-header {
    padding: 10px 14px !important;
  }

  .lightbox-meta-body {
    padding: 10px 14px !important;
    max-height: 24vh !important;
  }

  .lightbox-footer {
    padding: 10px 14px !important;
    flex-wrap: wrap !important;
  }
}

.media-load-error {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.media-load-error-banner {
  padding: 10px 12px;
  background: rgba(127, 29, 29, 0.55);
  border: 1px solid #f87171;
  color: #fecaca;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  margin: 6px;
  text-align: center;
}

/* ============================================================================
   COMMERCIAL V2 MULTI-TENANT PLATFORM STYLES (3-ZONE ARCHITECTURE)
   ============================================================================ */
.viewport-area {
  display: flex;
  flex-direction: column;
}

.view-pane {
  flex: 1;
  min-height: 0;
}

/* Role-based strict UI hiding for Customer and Public roles (backed by server 403 RBAC) */
body.role-customer .admin-only-nav,
body.role-customer #admin-tenant-create-section,
body.role-customer #btn-export-vps-bundle,
body.role-customer #btn-import-vps-bundle,
body.role-customer #btn-recover-interrupted-jobs,
body.role-customer #v2-admin-ops-card,
body.role-public .admin-only-nav,
body.role-public #admin-tenant-create-section,
body.role-public #btn-export-vps-bundle,
body.role-public #btn-import-vps-bundle,
body.role-public #btn-recover-interrupted-jobs,
body.role-public #v2-admin-ops-card {
  display: none !important;
}

.v2-pilot-banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 12.5px;
  line-height: 1.5;
}

.v2-ui-state-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}

.v2-ui-state-banner[data-ui-state="loading"] {
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
}

.v2-ui-state-banner[data-ui-state="timeout"],
.v2-ui-state-banner[data-ui-state="delivery_retry"] {
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
}

.v2-ui-state-banner[data-ui-state="quota_exhausted"],
.v2-ui-state-banner[data-ui-state="drive_revoked"] {
  border: 1px solid rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.12);
  color: #fecdd3;
}

.v2-zone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  background: #0F172A;
  color: #F8FAFC;
  border-bottom: 1px solid #1E293B;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.v2-zone-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.v2-zone-pill {
  background: #1E293B;
  color: #CBD5E1;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.v2-zone-pill:hover {
  background: #334155;
  color: #FFFFFF;
}

.v2-zone-pill.active {
  background: #4F46E5;
  color: #FFFFFF;
  border-color: #6366F1;
}

.v2-zone-telemetry {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
}

.studio-v2-quota-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.studio-v2-quota-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.v2-hero-card {
  padding: 24px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #F8FAFC;
  border: 1px solid #334155;
  margin-bottom: 16px;
}

.v2-hero-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.v2-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 8px;
}

.v2-hero-sub {
  font-size: 13.5px;
  color: #CBD5E1;
  line-height: 1.6;
  max-width: 880px;
  margin-bottom: 16px;
}

.v2-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.v2-pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.v2-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}

.v2-metric-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-metric-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
}

.v2-metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .v2-zone-bar {
    padding: 6px 10px;
  }
  .v2-zone-telemetry {
    display: none;
  }
  .studio-v2-quota-banner {
    padding: 6px 10px;
    font-size: 10.5px;
  }
  .v2-hero-title {
    font-size: 17px;
  }
}









