/* ============================================
   Autobees — Unified Inbox + Bee co-pilot UI
   The hero centrepiece. Honeycomb/bee motif.
   ============================================ */

/* App frame */
.inbox {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 20px;
  box-shadow: var(--shadow-glow), 0 1px 0 rgba(255,255,255,0.6) inset;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  position: relative;
}

/* Top bar */
.inbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, #fff, #fcfbfe);
}
.inbox-top-left { display: flex; align-items: center; gap: 12px; }
.inbox-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.inbox-title .mono { color: var(--softer); font-size: 11px; font-weight: 500; margin-left: 8px; }
.inbox-channels-mini { display: flex; align-items: center; }
.inbox-channels-mini .ci {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid #fff; margin-left: -7px; box-shadow: 0 1px 3px rgba(14,24,56,0.15);
}
.inbox-channels-mini .ci:first-child { margin-left: 0; }
.inbox-channels-mini .ci svg { width: 12px; height: 12px; }

.bee-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--brand-grad-soft);
  border: 1px solid rgba(91,27,152,0.15);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.bee-toggle .bee-avatar { width: 22px; height: 22px; }
.bee-toggle .bee-state {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--grad-1);
}

/* Body: rail + thread */
.inbox-body {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 520px;
}
@media (max-width: 760px) {
  .inbox-body { grid-template-columns: 1fr; }
  .inbox-rail { display: none !important; }
}

/* Conversation rail */
.inbox-rail {
  border-right: 1px solid var(--rule);
  background: #fcfbfd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rail-head {
  padding: 14px 16px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--softer);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rail-head .count {
  background: var(--brand-grad);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
}
.rail-list { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px; overflow-y: auto; }
.rail-item {
  display: flex;
  gap: 11px;
  padding: 11px 10px;
  border-radius: 12px;
  cursor: default;
  position: relative;
  transition: background 0.18s;
}
.rail-item.active { background: #fff; box-shadow: var(--shadow-soft); }
.rail-item.unread .rail-name { font-weight: 700; }
.rail-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
}
.rail-avatar .chan-badge {
  position: absolute;
  bottom: -2px; right: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fcfbfd;
  display: grid; place-items: center;
}
.rail-item.active .rail-avatar .chan-badge { border-color: #fff; }
.rail-avatar .chan-badge svg { width: 9px; height: 9px; }
.rail-meta { flex: 1; min-width: 0; }
.rail-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rail-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-time { font-size: 10px; color: var(--softer); font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.rail-snippet {
  font-size: 12px;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.rail-item.unread .rail-snippet { color: var(--ink-2); }
.rail-dot {
  position: absolute;
  left: 2px; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-grad);
}

/* Thread pane */
.inbox-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(91,27,152,0.03), transparent 60%);
}
.thread-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 12px;
}
.thread-head .rail-avatar { width: 34px; height: 34px; font-size: 13px; }
.thread-who { flex: 1; min-width: 0; }
.thread-name { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.thread-chan {
  font-size: 11px;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
}
.thread-chan .ci { width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; }
.thread-chan .ci svg { width: 8px; height: 8px; }

.thread-body {
  flex: 1;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}
.thread-body::-webkit-scrollbar { width: 0; }

.msg {
  max-width: 74%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  animation: bubble-in 0.32s cubic-bezier(0.16,1,0.3,1) both;
}
.msg.in { align-self: flex-start; background: #f1f2f6; color: #1a1a1a; border-bottom-left-radius: 5px; }
.msg.out {
  align-self: flex-end;
  background: linear-gradient(135deg, #5b1b98, #1a6fb8);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg-tag {
  align-self: flex-end;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--softer);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: bubble-in 0.3s ease both;
}
.msg-tag svg { width: 11px; height: 11px; color: #2A8E5C; }

/* Shared product chip inside thread */
.thread-product {
  align-self: flex-start;
  width: 356px;
  max-width: 76%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #fff;
  animation: bubble-in 0.32s cubic-bezier(0.16,1,0.3,1) both;
}
.thread-product img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.thread-product-meta { padding: 8px 12px; display: flex; justify-content: space-between; align-items: baseline; }
.thread-product-meta .nm { font-size: 12px; font-weight: 600; color: var(--ink); }
.thread-product-meta .pr {
  font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Bee composer dock ── */
.bee-dock {
  border-top: 1px solid var(--rule);
  background: linear-gradient(180deg, #fcfbfe, #fff);
  padding: 14px 16px 16px;
}
.bee-dock-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}
.bee-dock-head .bee-avatar { width: 26px; height: 26px; }
.bee-dock-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.bee-dock-label b {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700;
}
.bee-thinking {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--soft);
  font-family: 'JetBrains Mono', monospace;
}
.bee-thinking .dots { display: inline-flex; gap: 3px; }
.bee-thinking .dots span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--grad-2);
  animation: typing 1.2s ease-in-out infinite;
}
.bee-thinking .dots span:nth-child(2) { animation-delay: 0.15s; }
.bee-thinking .dots span:nth-child(3) { animation-delay: 0.3s; }

.bee-suggestions { display: flex; flex-direction: column; gap: 8px; }
.bee-sg {
  border: 1px solid var(--rule);
  border-radius: 13px;
  padding: 11px 13px;
  background: #fff;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  animation: sg-in 0.4s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes sg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.bee-sg:hover { border-color: rgba(91,27,152,0.3); }
.bee-sg.picked {
  border-color: transparent;
  background: var(--brand-grad-soft);
  box-shadow: 0 0 0 1.5px rgba(91,27,152,0.3);
}
.bee-sg-kind {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grad-1);
  background: var(--brand-grad-soft);
  border-radius: 6px;
  padding: 3px 7px;
  flex-shrink: 0;
  margin-top: 1px;
}
.bee-sg-text { flex: 1; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.bee-sg-actions { display: flex; gap: 6px; flex-shrink: 0; align-self: center; }
.bee-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.bee-send:hover { transform: translateY(-1px); }
.bee-send svg { width: 12px; height: 12px; }
.bee-edit {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--rule);
  background: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--soft);
  transition: border-color 0.15s, color 0.15s;
}
.bee-edit:hover { border-color: var(--ink-3); color: var(--ink); }
.bee-edit svg { width: 14px; height: 14px; }

.bee-own {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  border-radius: 11px;
  padding: 9px 12px;
  background: #fff;
  color: var(--softer);
  font-size: 12.5px;
}
.bee-own .own-spacer { flex: 1; }
.bee-own .own-pilot {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bee-own .own-pilot svg { width: 12px; height: 12px; color: var(--grad-2); }

/* tap ripple on send */
.tap-cursor {
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--grad-1);
  background: rgba(91,27,152,0.15);
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  transform: translate(-50%, -50%);
}
.tap-cursor.fire { animation: tap-fire 0.5s ease; }
@keyframes tap-fire {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(1.6); }
  40% { opacity: 1; transform: translate(-50%,-50%) scale(0.7); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.4); }
}

/* ── Bee avatar (SVG container helper) ── */
.bee-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.bee-avatar svg { width: 100%; height: 100%; display: block; }

/* floating accent tags around the inbox */
.inbox-stage { position: relative; }
.inbox-float {
  position: absolute;
  z-index: 8;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 10px 14px 10px 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: var(--shadow-lift);
  backdrop-filter: blur(8px);
}
.inbox-float .bee-avatar { width: 30px; height: 30px; }
.inbox-float .ttl { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.inbox-float .sub { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--soft); letter-spacing: 0.04em; }
.inbox-float-tl { top: -52px; left: 12px; }
.inbox-float-br { bottom: -20px; right: -26px; }
@media (max-width: 1080px) { .inbox-float-tl { left: 8px; } .inbox-float-br { right: 8px; } }
@media (max-width: 560px) { .inbox-float { display: none; } }

.replay-row {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--soft);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s;
}
.replay-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.replay-btn svg { width: 12px; height: 12px; }
