/* ═══════════════════════════════════════════════
   Alex Hub — Gemini-style clean chat UI
   ═══════════════════════════════════════════════ */

/* ── When Alex is active, remove parent padding/margin so chat fills the area ── */
.main-content:has(#section-alex.active) {
  padding: 0 !important;
  margin-top: 0 !important;
  overflow: hidden !important;
}
body:has(#section-alex.active) {
  overflow: hidden !important;
}
body:has(#section-alex.active) .topbar,
body:has(#section-alex.active) .mobile-header {
  display: none !important;
}

/* ── Section: fill available space ── */
#section-alex {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  animation: none !important;
  z-index: 10;
}

/* ── Hub layout ── */
.alex-hub {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-body);
}

/* ── Split layout (chat + action panel) ── */
.alex-hub-split {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.alex-hub-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  transition: flex .35s cubic-bezier(.4,0,.2,1);
}

/* ── Chat header (WhatsApp-style) ── */
.alex-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
body.light .alex-chat-header {
  background: rgba(0,0,0,.02);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.alex-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.alex-chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.alex-chat-header-info {
  display: flex;
  flex-direction: column;
}
.alex-chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.2;
}
.alex-chat-header-status {
  font-size: 12px;
  color: #22c55e;
  line-height: 1.2;
}
.alex-chat-header-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.alex-chat-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.alex-chat-header-btn:hover {
  background: rgba(167,139,250,.1);
  color: #a78bfa;
}

/* Header dropdown positioning */
.alex-chat-header-right .alex-dropdown-wrap {
  position: relative;
}
.alex-chat-header-right .alex-dropdown {
  top: 100%;
  right: 0;
  margin-top: 4px;
}
/* ── Hamburger icon (animated → cross) ── */
.alex-hamburger-btn {
  width: 42px !important;
  height: 42px !important;
  -webkit-tap-highlight-color: transparent;
}
.alex-hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 18px;
  height: 14px;
  position: relative;
}
.alex-hamburger-icon span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform .25s ease, opacity .2s ease;
  position: absolute;
  left: 0;
}
.alex-hamburger-icon span:nth-child(1) { top: 0; }
.alex-hamburger-icon span:nth-child(2) { top: 6px; }
.alex-hamburger-icon span:nth-child(3) { top: 12px; }

/* Cross state */
.alex-hamburger-btn.active .alex-hamburger-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.alex-hamburger-btn.active .alex-hamburger-icon span:nth-child(2) {
  opacity: 0;
}
.alex-hamburger-btn.active .alex-hamburger-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Full-width nav menu ── */
.alex-nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--bg-card, rgba(12,18,40,.6));
  border-bottom: 1px solid rgba(255,255,255,.06);
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.4,0,.2,1), padding .3s ease;
  padding: 0 8px;
  flex-shrink: 0;
}
.alex-nav-menu.open {
  max-height: 200px;
  padding: 8px;
}
.alex-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--text-body, #c8ccd4);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: background .15s;
  width: 50%;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.alex-nav-item:active {
  background: rgba(167,139,250,.12);
}
.alex-nav-item svg {
  color: var(--text-secondary, #999);
  flex-shrink: 0;
}

/* Tasks badge on header button */
#alex-tasks-btn-header {
  position: relative;
}
#alex-tasks-btn-header .alex-tasks-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #a78bfa;
  border-radius: 50%;
}

/* ── Scroll area (welcome + messages + typing) ── */
.alex-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
/* Push all content to bottom of chat (like WhatsApp) */
.alex-scroll::before {
  content: '';
  flex: 1;
}

/* ── Welcome ── */
.alex-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.alex-welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(167,139,250,.3);
}

.alex-welcome h2 {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 28px;
  letter-spacing: -.01em;
}

/* ── Suggestions ── */
.alex-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 16px;
  max-width: 100%;
  box-sizing: border-box;
}

.alex-suggestion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-body, #c8ccd4);
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: calc(50% - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.alex-suggestion-btn:hover {
  background: rgba(167,139,250,.08);
  border-color: rgba(167,139,250,.3);
  color: #a78bfa;
}

.alex-suggestion-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.alex-suggestion-btn:hover .alex-suggestion-icon {
  color: #a78bfa;
}

/* ── Messages container ── */
.alex-messages {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 24px 24px;
}

/* ── Single message ── */
.alex-msg {
  margin-bottom: 24px;
  animation: alexFadeIn .25s ease;
}

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

/* ── User message ── */
.alex-msg.user {
  display: flex;
  justify-content: flex-end;
}

.alex-msg.user .alex-msg-inner {
  max-width: 80%;
  background: rgba(167,139,250,.12);
  border-radius: 20px 20px 4px 20px;
  padding: 12px 18px;
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Assistant message ── */
.alex-msg.assistant {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alex-msg.assistant .alex-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

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

.alex-msg-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.2;
}

.alex-msg.assistant .alex-msg-inner {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-body);
}

/* ── Markdown inside assistant messages ── */
.alex-msg-inner p {
  margin: 0 0 10px;
}
.alex-msg-inner p:last-child {
  margin-bottom: 0;
}
.alex-msg-inner h1, .alex-msg-inner h2, .alex-msg-inner h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  margin: 16px 0 6px;
}
.alex-msg-inner h1:first-child, .alex-msg-inner h2:first-child, .alex-msg-inner h3:first-child {
  margin-top: 0;
}
.alex-msg-inner ul, .alex-msg-inner ol {
  padding-left: 20px;
  margin: 8px 0;
}
.alex-msg-inner li {
  margin-bottom: 4px;
}
.alex-msg-inner li::marker {
  color: var(--text-secondary);
}
.alex-msg-inner strong {
  font-weight: 600;
  color: var(--text-heading);
}
.alex-msg-inner code {
  background: rgba(167,139,250,.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.alex-msg-inner a {
  color: #a78bfa;
  text-decoration: none;
}
.alex-msg-inner a:hover {
  text-decoration: underline;
}
.alex-msg-inner table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.alex-msg-inner th, .alex-msg-inner td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.alex-msg-inner th {
  font-weight: 600;
  color: var(--text-heading);
}

/* ── Attachments in messages ── */
.alex-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.alex-msg-attachment-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
}

.alex-msg-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(167,139,250,.06);
  border: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-body);
  text-decoration: none;
  transition: background .15s;
}
.alex-msg-attachment-file:hover {
  background: rgba(167,139,250,.12);
}

/* ── Typing indicator ── */
.alex-typing {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 16px;
}

.alex-typing-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alex-typing-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.alex-typing-dots {
  display: flex;
  gap: 4px;
}

.alex-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: alexDot 1.4s infinite;
}

.alex-typing-dots span:nth-child(2) { animation-delay: .2s; }
.alex-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes alexDot {
  0%, 80%, 100% { transform: scale(.4); opacity: .3; }
  40% { transform: scale(1); opacity: 1; }
}

.alex-typing-message {
  margin-left: 8px;
  font-size: 13px;
  color: #a78bfa;
  font-weight: 500;
  letter-spacing: -.01em;
  animation: alexStatusFade .3s ease;
}
.alex-typing-message:empty {
  display: none;
}
@keyframes alexStatusFade {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Streaming cursor ── */
.alex-msg-inner.alex-streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #a78bfa;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: alexCursorBlink .8s step-end infinite;
}
@keyframes alexCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Input area ── */
.alex-input-area {
  flex-shrink: 0;
  padding: 0 24px 15px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

.alex-input-bar {
  background: var(--gray-100, rgba(255,255,255,.05));
  border-radius: 28px;
  padding: 8px;
}

.alex-input-top {
  padding: 12px 20px 0;
}

/* Plus button & input bottom left buttons */
.alex-input-left-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}
.alex-input-plus-wrap {
  position: relative;
  flex-shrink: 0;
}
.alex-input-plus-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-elevated, #1e1e2e);
  border: 1px solid var(--border-color, rgba(255,255,255,.1));
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 100;
}
.alex-input-plus-menu.open {
  display: block;
}
body.light .alex-input-plus-menu {
  background: #fff;
  border-color: #e5e7eb;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.alex-plus-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, rgba(255,255,255,.35));
  padding: 8px 12px 4px;
}
.alex-plus-agents {
  padding: 4px 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.alex-plus-divider {
  height: 1px;
  background: var(--border-color, rgba(255,255,255,.08));
  margin: 2px 0;
}
body.light .alex-plus-divider {
  background: #e5e7eb;
}
/* Bottom agents dropdown opens upward */
.alex-dropdown-agents-bottom {
  bottom: calc(100% + 8px) !important;
  top: auto !important;
  left: 0 !important;
}

.alex-input-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 4px;
}
.alex-input-right-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

#alex-input {
  width: 100%;
  border: none !important;
  background: none !important;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-body);
  resize: none;
  max-height: 120px;
  min-height: 0 !important;
  height: 24px;
  line-height: 24px;
  padding: 0 !important;
  box-shadow: none !important;
}

#alex-input::placeholder {
  color: var(--text-secondary);
}

/* Icon buttons (attach + send) */
.alex-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.alex-icon-btn:hover {
  background: rgba(255,255,255,.08);
  color: var(--text-heading);
}

.alex-mic-btn {
  color: var(--text-secondary);
  transition: color .2s, background .2s;
}
.alex-mic-btn.recording {
  color: #ef4444;
  background: rgba(239, 68, 68, .12);
  animation: alexMicPulse 1.5s ease-in-out infinite;
}
@keyframes alexMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .3); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.alex-send-btn {
  color: var(--text-secondary);
}

.alex-send-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.alex-send-btn:disabled:hover {
  background: transparent;
}

/* ── Attachment preview strip ── */
.alex-attachments-preview {
  display: flex;
  gap: 8px;
  padding: 12px 12px 4px;
  overflow-x: auto;
}

.alex-attachment-thumb {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--bg-input);
}

.alex-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.alex-attachment-thumb-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 4px;
}

.alex-attachment-thumb-file span {
  font-size: 10px;
  color: var(--text-secondary);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.alex-attachment-thumb-file svg {
  color: var(--text-secondary);
}

.alex-attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  backdrop-filter: blur(4px);
}

/* ── Dropdown system ── */
.alex-input-left-btns {
  display: flex;
  gap: 2px;
}

.alex-dropdown-wrap {
  position: relative;
}

.alex-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  background: rgba(24, 24, 38, .94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  padding: 6px 0;
  z-index: 100;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}

.alex-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

body.light .alex-dropdown {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

.alex-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-body);
  text-align: left;
  transition: background .12s;
}

.alex-dropdown-item:hover {
  background: rgba(167,139,250,.06);
}

.alex-dropdown-item svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.alex-dropdown-agents {
  width: 220px;
}

.alex-tools-agents {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  justify-content: center;
}

.alex-tools-agent {
  position: relative;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all .15s;
}

.alex-tools-agent-initial {
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.alex-tools-agent:hover {
  border-color: rgba(167,139,250,.5);
  transform: scale(1.1);
}

.alex-tools-agent.active {
  border-color: #a78bfa;
}

.alex-tools-agent-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}

.alex-tools-agent:hover .alex-tools-agent-tooltip {
  opacity: 1;
}

body.light .alex-tools-agent-tooltip {
  background: rgba(0,0,0,.75);
}

.alex-tools-divider {
  height: 1px;
  background: var(--border-color);
  margin: 2px 0;
}

.alex-tools-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-body);
  text-align: left;
  transition: background .12s;
}

.alex-tools-item:hover {
  background: rgba(167,139,250,.06);
}

.alex-tools-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.alex-tools-item-label {
  flex: 1;
}

.alex-tools-item-agent {
  font-size: 11px;
  color: var(--text-secondary);
}


/* ── @Tag chip ── */
.alex-tag-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 4px;
}

.alex-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px 2px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 22px;
  white-space: nowrap;
  animation: alexFadeIn .15s ease;
}

.alex-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.15);
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  transition: background .12s;
}

.alex-tag-remove:hover {
  background: rgba(0,0,0,.3);
}

/* ── @Mention autocomplete ── */
.alex-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 24px;
  width: 220px;
  background: rgba(24, 24, 38, .94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  padding: 4px 0;
  z-index: 110;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .12s, transform .12s;
}

.alex-autocomplete.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

body.light .alex-autocomplete {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

.alex-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .1s;
}

.alex-autocomplete-item:hover,
.alex-autocomplete-item.highlighted {
  background: rgba(167,139,250,.08);
}

.alex-autocomplete-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.alex-autocomplete-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-heading);
}

.alex-autocomplete-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Footer bar (removed — new chat button moved to header) ── */

.alex-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  transition: color .15s, background .15s;
}

.alex-footer-btn:hover {
  color: #a78bfa;
  background: rgba(167,139,250,.06);
}

.alex-footer-agent {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .alex-welcome h2 {
    font-size: 22px;
  }

  .alex-messages {
    padding: 8px 12px 8px;
  }

  .alex-input-area {
    padding: 0 10px 15px;
  }
  .alex-input-area.collapsed {
    display: none !important;
  }
}
.alex-input-collapse {
  display: none;
}
@media (max-width: 768px) {
  .alex-input-collapse {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--gray-100, rgba(255,255,255,.05));
    border-top: 1px solid rgba(255,255,255,.06);
    color: var(--text-secondary, #999);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .alex-input-collapse.visible {
    display: flex !important;
  }
  .alex-input-collapse:active {
    background: rgba(255,255,255,.08);
  }
  .alex-input-collapse-text {
    opacity: 0.6;
  }
  .alex-input-bar {
    padding: 6px;
    border-radius: 22px;
  }
  .alex-input-top {
    padding: 8px 14px 0;
  }
  .alex-chat-header {
    padding: 8px 12px;
  }

  .alex-suggestions {
    gap: 6px;
    padding: 0 12px;
  }

  .alex-suggestion-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .alex-msg.user .alex-msg-inner {
    max-width: 90%;
  }

  .alex-typing {
    padding: 0 16px 12px;
  }

  .alex-dropdown-agents {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: auto;
    width: auto;
  }
  .alex-chat-header-right .alex-dropdown-agents {
    position: absolute;
    left: auto;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 260px;
    max-height: 60vh;
    overflow-y: auto;
  }
  .alex-chat-header-right .alex-dropdown {
    position: absolute;
    left: auto;
    right: 0;
    top: 100%;
    bottom: auto;
    margin-top: 4px;
    min-width: 200px;
  }
  .alex-dropdown {
    position: fixed;
    left: 16px;
    bottom: 80px;
    width: auto;
    min-width: 180px;
  }
}

/* ── Tablet ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .alex-messages,
  .alex-input-area,
  .alex-typing {
    max-width: 640px;
  }
  .alex-action-panel.open {
    width: 50%;
  }
}

/* ── Desktop: offset for sidebar ── */
@media (min-width: 769px) {
  .alex-chat-header {
    padding: 12px 20px 12px 90px;
  }
}

/* ── Desktop dropdown (replaces bottom sheet on desktop) ── */
.alex-desktop-dropdown {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card, rgba(12,18,40,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  transform: scale(0.95) translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
  max-height: 70vh;
  overflow-y: auto;
}
.alex-desktop-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.alex-desktop-dropdown .alex-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  width: 100%;
  border: none;
  background: none;
  color: var(--text-body, #c8ccd4);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  transition: background .12s;
}
.alex-desktop-dropdown .alex-dropdown-item:hover {
  background: rgba(167,139,250,.1);
}
body.light .alex-desktop-dropdown {
  background: rgba(255,255,255,.95);
  border-color: rgba(0,0,0,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

/* ═══════════════════════════════════════════════
   Action Panel — Slide-out panel for workflows
   ═══════════════════════════════════════════════ */

.alex-action-panel {
  width: 0;
  height: 0;
  overflow: hidden;
  border-left: 1px solid transparent;
  display: none;
  flex-direction: column;
  background: var(--bg-body);
  transition: width .35s cubic-bezier(.4,0,.2,1), border-color .35s ease;
  position: relative;
}
.alex-action-panel.open {
  display: flex;
  width: 520px;
  height: auto;
  border-left-color: var(--border-color, rgba(255,255,255,.08));
}
.alex-action-drag-handle {
  display: none;
}
@media (max-width: 768px) {
  .alex-action-panel.open .alex-action-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 20px;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
  }
  .alex-action-panel.open .alex-action-drag-handle::after {
    content: '';
    width: 32px;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
  }
  .alex-action-drag-handle:active {
    cursor: grabbing;
  }
}

/* ── Header ── */
.alex-action-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,.08));
  min-height: 56px;
  flex-shrink: 0;
}
.alex-action-back {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary, #999);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
/* Hide close button in tasks view — use footer sluiten button instead */
.alex-action-panel[data-view="tasks"] .alex-action-close,
.alex-action-panel[data-view="task-detail"] .alex-action-close {
  display: none;
}
.alex-action-panel[data-view="tasks"] .alex-action-back,
.alex-action-panel[data-view="task-detail"] .alex-action-back {
  display: flex;
}
.alex-action-back:hover {
  color: var(--text-primary, #fff);
  background: rgba(255,255,255,.06);
}
.alex-action-header-info {
  flex: 1;
  min-width: 0;
}
.alex-action-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alex-action-agent {
  display: block;
  font-size: 12px;
  color: var(--text-secondary, #999);
  margin-top: 1px;
}
.alex-action-close {
  background: none;
  border: none;
  color: var(--text-secondary, #999);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.alex-action-close:hover {
  color: var(--text-primary, #fff);
  background: rgba(255,255,255,.06);
}

/* ── Step Timeline (horizontal compact) ── */
.alex-action-steps {
  padding: 12px 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.alex-action-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  flex: 1;
  min-width: 0;
}
.alex-action-step:last-child {
  padding-bottom: 0;
}
/* Horizontal connector line */
.alex-action-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 10px;
  left: calc(50% + 12px);
  right: calc(-50% + 12px);
  height: 2px;
  background: var(--border-color, rgba(255,255,255,.1));
  z-index: 0;
}
.alex-action-step.done:not(:last-child)::after {
  background: #10b981;
}
.alex-action-step.running:not(:last-child)::after {
  background: linear-gradient(90deg, #a78bfa 0%, var(--border-color, rgba(255,255,255,.1)) 100%);
}

/* Step dot */
.alex-action-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  position: relative;
  z-index: 1;
  transition: all .3s ease;
}
.alex-action-step.pending .alex-action-dot {
  background: var(--bg-card, rgba(255,255,255,.04));
  border: 2px solid var(--border-color, rgba(255,255,255,.12));
  color: var(--text-secondary, #666);
}
.alex-action-step.running .alex-action-dot {
  background: #a78bfa;
  border: 2px solid #a78bfa;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(167,139,250,.2);
  animation: actionPulse 2s ease-in-out infinite;
}
.alex-action-step.done .alex-action-dot {
  background: #10b981;
  border: 2px solid #10b981;
  color: #fff;
}
.alex-action-step.error .alex-action-dot {
  background: #ef4444;
  border: 2px solid #ef4444;
  color: #fff;
}
.alex-action-step.cancelled .alex-action-dot {
  background: var(--bg-card, rgba(255,255,255,.04));
  border: 2px solid var(--text-secondary, #666);
  color: var(--text-secondary, #666);
}

@keyframes actionPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(167,139,250,.2); }
  50% { box-shadow: 0 0 0 6px rgba(167,139,250,.1); }
}

/* Step label */
.alex-action-step-label {
  font-size: 11px;
  color: var(--text-secondary, #999);
  text-align: center;
  line-height: 1.2;
  transition: color .3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.alex-action-step.running .alex-action-step-label {
  color: var(--text-primary, #fff);
  font-weight: 500;
}
.alex-action-step.done .alex-action-step-label {
  color: #10b981;
}
.alex-action-step.error .alex-action-step-label {
  color: #ef4444;
}
@media (max-width: 600px) {
  .alex-action-steps { padding: 8px 12px; }
  .alex-action-step-label { font-size: 0; width: 0; overflow: hidden; }
  .alex-action-dot { width: 16px; height: 16px; font-size: 8px; }
}

/* ── Content Area ── */
.alex-action-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  min-height: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.alex-action-content * {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.alex-action-content:empty {
  display: none;
}

/* Preview containers */
.alex-action-content .action-preview-card {
  background: var(--bg-card, rgba(255,255,255,.03));
  border: 1px solid var(--border-color, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 24px;
  animation: actionFadeIn .4s ease;
}
.alex-action-content .action-preview-card h1,
.alex-action-content .action-preview-card h2,
.alex-action-content .action-preview-card h3 {
  color: var(--text-primary, #fff);
  margin-bottom: 12px;
}
.alex-action-content .action-preview-card p {
  color: var(--text-secondary, #ccc);
  line-height: 1.7;
  margin-bottom: 8px;
}

/* Meta stats in preview */
.action-preview-meta {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,.08));
}
.action-preview-meta h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.action-preview-meta .meta-desc {
  font-size: 14px;
  color: var(--text-secondary, #999);
  font-style: italic;
}
.action-preview-meta .meta-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary, #888);
}
.action-preview-meta .meta-stats span {
  background: rgba(167,139,250,.1);
  padding: 4px 10px;
  border-radius: 20px;
  color: #a78bfa;
  font-weight: 500;
}

/* Image preview */
.action-preview-image img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 16px;
  object-fit: cover;
  max-height: 240px;
}

/* Article body (editable) */
.action-preview-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary, #ccc);
}
.action-preview-body[contenteditable="true"] {
  outline: none;
  border-radius: 8px;
  padding: 12px;
  border: 1px dashed rgba(167,139,250,.3);
  transition: border-color .2s;
}
.action-preview-body[contenteditable="true"]:focus {
  border-color: #a78bfa;
  background: rgba(167,139,250,.03);
}
.action-preview-body h2 { font-size: 18px; color: var(--text-primary, #fff); margin: 20px 0 8px; }
.action-preview-body h3 { font-size: 16px; color: var(--text-primary, #fff); margin: 16px 0 6px; }
.action-preview-body ul, .action-preview-body ol { padding-left: 20px; margin: 8px 0; }
.action-preview-body li { margin: 4px 0; }

/* Social mockup cards */
.action-social-mockups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.action-social-card {
  background: var(--bg-card, rgba(255,255,255,.03));
  border: 1px solid var(--border-color, rgba(255,255,255,.08));
  border-radius: 12px;
  overflow: hidden;
  animation: actionFadeIn .4s ease;
}
.action-social-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,.06));
}
.action-social-platform-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.action-social-platform-icon.linkedin { background: #0077b5; }
.action-social-platform-icon.instagram { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.action-social-platform-icon.facebook { background: #1877f2; }
.action-social-card-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary, #ccc);
  white-space: pre-wrap;
}
.action-social-card-body[contenteditable="true"] {
  outline: none;
}
.action-social-card-body[contenteditable="true"]:focus {
  background: rgba(167,139,250,.03);
}
.action-social-hashtags {
  padding: 8px 16px 12px;
  font-size: 12px;
  color: #a78bfa;
}

/* Chart containers */
.action-chart-container {
  background: var(--bg-card, rgba(255,255,255,.03));
  border: 1px solid var(--border-color, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 20px;
}
.action-chart-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.action-chart-bar-label {
  flex: 0 0 140px;
  font-size: 12px;
  color: var(--text-secondary, #999);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-chart-bar-track {
  flex: 1;
  height: 24px;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.action-chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.action-chart-bar-fill.position { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.action-chart-bar-fill.clicks { background: linear-gradient(90deg, #10b981, #059669); }

/* Markdown in action panel */
.alex-action-content .action-md {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary, #ccc);
  overflow-wrap: break-word;
  word-break: break-word;
}
.alex-action-content .action-md h3 { color: var(--text-primary, #fff); margin: 16px 0 8px; font-size: 16px; }
.alex-action-content .action-md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.alex-action-content .action-md th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border-color, rgba(255,255,255,.12)); color: var(--text-primary, #fff); font-weight: 600; }
.alex-action-content .action-md td { padding: 6px 10px; border-bottom: 1px solid var(--border-color, rgba(255,255,255,.06)); }
.alex-action-content .action-md strong { color: var(--text-primary, #fff); }
.alex-action-content .action-md em { color: var(--text-secondary, #aaa); }
.alex-action-content .action-md ul { padding-left: 18px; }
.alex-action-content .action-md li { margin: 4px 0; }

/* ── Footer (action buttons) ── */
.alex-action-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color, rgba(255,255,255,.08));
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.alex-action-footer:empty {
  display: none;
}
.alex-action-btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 40px;
}
.alex-action-btn.primary {
  background: #a78bfa;
  color: #fff;
  border-color: #a78bfa;
}
.alex-action-btn.primary:hover {
  background: #9470f5;
}
.alex-action-btn.secondary {
  background: transparent;
  color: var(--text-primary, #fff);
  border-color: var(--border-color, rgba(255,255,255,.15));
}
.alex-action-btn.secondary:hover {
  background: rgba(255,255,255,.08);
}
.alex-action-btn.ghost {
  background: transparent;
  color: var(--text-secondary, #aaa);
  border-color: rgba(255,255,255,.1);
  font-weight: 500;
}
.alex-action-btn.ghost:hover {
  color: var(--text-primary, #fff);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
}
.alex-action-btn.danger {
  background: transparent;
  color: #ef4444;
  border-color: rgba(239,68,68,.2);
  font-weight: 500;
}
.alex-action-btn.danger:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
}

/* SEO check details in preview */
.action-preview-seo {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, rgba(255,255,255,.08));
}
.action-preview-seo summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #999);
}
.action-preview-seo summary:hover {
  color: var(--text-primary, #fff);
}
.action-preview-seo .action-md {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary, #ccc);
  line-height: 1.6;
}

/* Preview card overflow fix */
.action-preview-card {
  overflow-x: auto;
  overflow-y: visible;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}
.action-preview-card .action-md {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.action-preview-card .action-md pre,
.action-preview-card .action-md code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}
.action-preview-card .action-md ul,
.action-preview-card .action-md ol {
  padding-left: 16px;
  word-break: break-word;
}
.action-preview-card .action-md li {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ── Team Suggestions ── */
.action-team-suggestions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-team-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #999);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.action-suggestion-card {
  background: var(--bg-card, rgba(255,255,255,.03));
  border: 1px solid var(--border-color, rgba(255,255,255,.08));
  border-radius: 10px;
  padding: 14px;
  animation: actionFadeIn .4s ease;
}
.action-suggestion-agent {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.action-suggestion-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.action-suggestion-name {
  font-size: 12px;
  font-weight: 600;
}
.action-suggestion-text {
  font-size: 13px;
  color: var(--text-secondary, #ccc);
  line-height: 1.5;
  margin-bottom: 10px;
}
.action-suggestion-btn {
  background: transparent;
  border: 1px solid var(--border-color, rgba(255,255,255,.12));
  color: var(--text-primary, #fff);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}
.action-suggestion-btn:hover {
  background: rgba(255,255,255,.06);
}
.action-suggestion-btn:disabled {
  cursor: default;
  opacity: .7;
}

/* ── Tasks Panel ── */
.action-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-task-card {
  background: var(--bg-card, rgba(255,255,255,.03));
  border: 1px solid var(--border-color, rgba(255,255,255,.08));
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all .2s;
}
.action-task-card:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
}
.action-task-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.action-task-type {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #999);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.action-task-status {
  font-size: 11px;
  font-weight: 500;
}
.action-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-task-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary, #888);
}

/* ── Tasks badge ── */
.alex-tasks-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #f59e0b;
  border-radius: 50%;
}
#alex-tasks-btn {
  position: relative;
}

/* ── Animations ── */
@keyframes actionFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes actionSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════
   Action Chat Card — In-chat workflow indicator
   ═══════════════════════════════════════════════ */

.alex-action-chat-card {
  background: linear-gradient(135deg,
    rgba(167,139,250,.06) 0%,
    rgba(139,92,246,.03) 100%
  ) !important;
  border: 1px solid rgba(167,139,250,.15) !important;
  border-radius: 16px !important;
  padding: 0 !important;
  overflow: hidden;
  animation: actionCardSlideIn .5s cubic-bezier(.4,0,.2,1);
  max-width: 400px !important;
}
@keyframes actionCardSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.alex-action-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
}
.alex-action-chat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.alex-action-chat-icon svg {
  stroke: #fff;
}
.alex-action-chat-info {
  flex: 1;
  min-width: 0;
}
.alex-action-chat-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #fff);
}
.alex-action-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary, #999);
  margin-top: 2px;
  transition: color .3s;
}

/* Pulsing dot */
.alex-action-chat-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a78bfa;
  animation: chatPulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes chatPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); }
}

/* Mini step indicators */
.alex-action-chat-steps {
  display: flex;
  gap: 2px;
  padding: 0 18px 14px;
  flex-wrap: wrap;
}
.alex-action-chat-step {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary, #666);
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.03);
  transition: all .3s ease;
}
.alex-action-chat-step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary, #555);
  transition: all .3s ease;
  flex-shrink: 0;
}

/* Step states */
.alex-action-chat-step.running {
  background: rgba(167,139,250,.1);
  color: #a78bfa;
}
.alex-action-chat-step.running .alex-action-chat-step-dot {
  background: #a78bfa;
  animation: chatPulse 1.5s ease-in-out infinite;
}
.alex-action-chat-step.done {
  background: rgba(16,185,129,.08);
  color: #10b981;
}
.alex-action-chat-step.done .alex-action-chat-step-dot {
  background: #10b981;
}
.alex-action-chat-step.error {
  background: rgba(239,68,68,.08);
  color: #ef4444;
}
.alex-action-chat-step.error .alex-action-chat-step-dot {
  background: #ef4444;
}

/* View button */
.alex-action-chat-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  border-top: 1px solid rgba(167,139,250,.1);
  background: rgba(167,139,250,.04);
  color: #a78bfa;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.alex-action-chat-view:hover {
  background: rgba(167,139,250,.1);
}

/* ── Mobile: Action panel as bottom sheet ── */
.alex-mobile-toggle {
  display: none;
}
@media (max-width: 768px) {
  /* Mobile split: chat top, wizard bottom */
  .alex-hub-split {
    flex-direction: column;
  }

  /* Chat compact when action panel open — no scroll, no extra space */
  .alex-hub-split:has(.alex-action-panel.open) .alex-hub-chat {
    flex: none;
    height: auto;
    max-height: 30%;
    overflow: hidden;
  }
  /* Hide input area when workflow is active */
  .alex-hub-split:has(.alex-action-panel.open) .alex-input-area {
    display: none;
  }
  /* No scroll in compact chat — just show latest messages */
  .alex-hub-split:has(.alex-action-panel.open) .alex-scroll {
    overflow: hidden;
  }

  /* Action panel takes remaining space */
  .alex-action-panel.open {
    width: 100% !important;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 2px solid rgba(167,139,250,0.3);
    position: relative;
    animation: slideUpPanel .25s cubic-bezier(.4,0,.2,1);
  }
  @keyframes slideUpPanel {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
  }
  /* Compact panels (actions/agents/notifications) — fit content, draggable */
  .alex-action-panel.open[data-view="actions"],
  .alex-action-panel.open[data-view="agents"],
  .alex-action-panel.open[data-view="switcher"],
  .alex-action-panel.open[data-view="notifications"] {
    flex: none !important;
    height: auto;
    max-height: 60vh;
  }
  .alex-action-panel[data-view="actions"] .alex-action-content,
  .alex-action-panel[data-view="agents"] .alex-action-content,
  .alex-action-panel[data-view="switcher"] .alex-action-content,
  .alex-action-panel[data-view="notifications"] .alex-action-content {
    padding: 4px 0 8px !important;
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  /* Drag handle — real element for touch dragging */
  .alex-action-panel.open::before {
    display: none;
  }

  .alex-action-back {
    display: flex;
  }
  .alex-action-close {
    display: none;
  }
  .alex-action-steps {
    padding: 8px 12px;
  }
  .alex-action-step-label {
    font-size: 0;
    width: 0;
    overflow: hidden;
  }
  .alex-action-dot {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
  .alex-action-content {
    padding: 16px;
  }
  .alex-action-footer {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 6px;
  }
  .alex-action-btn {
    font-size: 12px;
    padding: 8px 10px;
    min-height: 36px;
    border-radius: 10px;
    flex: 1;
  }
  .alex-action-btn svg {
    display: none;
  }
  .alex-action-content .action-md {
    font-size: 12px;
    line-height: 1.5;
  }
}

/* ═══ RECONNECT BANNER ═══ */
.alex-reconnect-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(167,139,250,0.12);
  border-bottom: 1px solid rgba(167,139,250,0.2);
  flex-shrink: 0;
}

/* ═══ NAV SHORTCUT BUTTON ═══ */

#nav-alex .nav-agent-label {
  flex: 1;
}
.nav-dropdown-shortcut {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s;
  flex-shrink: 0;
}
.nav-dropdown-shortcut:hover {
  opacity: 1;
  background: rgba(167,139,250,0.12);
}

/* ═══ KANBAN BOARD ═══ */

#section-alex-board.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
}
.alex-board-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.alex-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary, rgba(255,255,255,0.06));
  flex-shrink: 0;
}
.alex-board-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.alex-board-back {
  background: none;
  border: none;
  color: var(--text-secondary, #999);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.alex-board-back:hover { color: #fff; background: rgba(255,255,255,0.06); }
.alex-board-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #fff);
}
.alex-board-header-right {
  display: flex;
  gap: 8px;
}
.alex-board-add-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary, #999);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.alex-board-add-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
}

.alex-board-columns {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
}

.alex-board-col {
  min-width: 220px;
  max-width: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alex-board-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}
.alex-board-col-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #999);
}
.alex-board-col-count {
  font-size: 11px;
  color: var(--text-muted, #666);
  background: rgba(255,255,255,0.04);
  padding: 1px 7px;
  border-radius: 10px;
}
.alex-board-col-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 60px;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.15s;
}
.alex-board-col-cards.drag-over {
  background: rgba(167,139,250,0.06);
}

/* Cards */
.alex-board-card {
  background: var(--bg-secondary, rgba(255,255,255,0.03));
  border: 1px solid var(--border-primary, rgba(255,255,255,0.06));
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  transition: all 0.15s;
  position: relative;
}
.alex-board-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.alex-board-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}
.alex-board-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #fff);
  margin-bottom: 6px;
  line-height: 1.3;
}
.alex-board-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.alex-board-card-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}
.alex-board-card-agent {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.alex-board-card-date {
  font-size: 10px;
  color: var(--text-muted, #666);
  margin-left: auto;
}
.alex-board-card-priority-high {
  border-left: 3px solid #ef4444;
}
.alex-board-card-priority-low {
  border-left: 3px solid var(--border-primary, rgba(255,255,255,0.06));
}

/* Mobile */
@media (max-width: 768px) {
  .alex-board-columns {
    padding: 10px;
    gap: 10px;
  }
  .alex-board-col {
    min-width: 200px;
  }
}

/* ═══ CARD MODAL (Trello-style) ═══ */

.alex-card-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  overflow-y: auto;
}
.alex-card-modal {
  background: var(--bg-primary, #0f0f0f);
  border: 1px solid var(--border-primary, rgba(255,255,255,0.08));
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: cardModalIn 0.2s ease-out;
}
@keyframes cardModalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.alex-card-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 0;
  gap: 12px;
}
.alex-card-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  line-height: 1.3;
  flex: 1;
}
.alex-card-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary, #999);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
}
.alex-card-modal-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
.alex-card-modal-body {
  padding: 16px 20px;
}
.alex-card-modal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alex-card-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.alex-card-modal-label {
  font-size: 12px;
  color: var(--text-secondary, #999);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.alex-card-modal-value {
  font-size: 13px;
  color: var(--text-primary, #fff);
}
.alex-card-modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .alex-card-modal-overlay {
    padding: 20px 12px;
    align-items: center;
  }
}

/* -- Notification Cards -- */
.alex-notif-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid #a78bfa;
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 420px;
}
body.light .alex-notif-card {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
}
.alex-notif-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.alex-notif-card-icon {
  flex-shrink: 0;
  opacity: 0.8;
}
.alex-notif-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #fff);
}
.alex-notif-card-body {
  font-size: 12px;
  color: var(--text-secondary, #999);
  margin-top: 6px;
  line-height: 1.5;
}
.alex-notif-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.alex-notif-card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary, #a78bfa);
  text-decoration: none;
}
.alex-notif-card-link:hover {
  text-decoration: underline;
}
.alex-notif-card-time {
  font-size: 11px;
  color: var(--text-secondary, #999);
  opacity: 0.6;
  margin-left: auto;
}

/* -- Unread dot on agent items -- */
.alex-agent-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}
