/* ── Component: CompanyHub, WorldHub, company cards ──
 * Class prefix: hub-
 */

/* ═══════════════════════════════════════════════════════════════
   Hub + Company Cards — Futuristic Command-Center Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom property for animated conic gradient ── */
@property --glow-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* ── Screen-reader-only utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Skip link (visible on :focus) ── */
.hub-skip-link {
  background: #6C3BEE;
  color: #fff;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
}

.hub-skip-link:focus {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  padding: 10px 20px;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
}

/* ── Animated background ── */
.hub-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--color-bg);
  overflow: hidden;
}

.hub-bg::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg at 30% 40%,
    #6C3BEE22 0deg,
    #2563EB11 90deg,
    #05966911 180deg,
    #DB277711 270deg,
    #6C3BEE22 360deg
  );
  /* Slowed from 20s → 90s. The conic gradient is so subtle (single-digit
     opacities) that nobody notices the rotation at 20s; it just costs GPU.
     90s reads as ambient depth, not motion. */
  animation: rotate-bg 90s linear infinite;
  /* Skip composition when offscreen (browser hint). */
  contain: paint;
}

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

.hub-bg-ambient {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0;
  transition: opacity 1s ease, background 1s ease, transform 1s ease;
  pointer-events: none;
}

/* ── Persistent topbar variable ── */
body.has-topbar { --topbar-h: 68px; }

/* ── Hub layout ── */
.hub-wrap {
  position: relative;
}

.hub-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.has-topbar .hub-root { padding-top: var(--topbar-h); }

/* ── Persistent header (fixed above all overlays) ── */
.persistent-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
}

/* ── Header ── */
.hub-header {
  padding: calc(20px + var(--safe-top, 0px)) 32px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(12px);
  background: rgba(8, 11, 20, 0.6);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Scanning line animation on header bottom */
.hub-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #a78bfa44 20%,
    #a78bfa 50%,
    #a78bfa44 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: scan-line 4s linear infinite;
}

@keyframes scan-line {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Logo */
.hub-logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hub-logo-mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ── Hub header orbital animation (brand animation) ── */
.hub-orb-system {
  position: relative;
  width: 44px;
  height: 44px;
}

.hub-orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: hub-orb-spin linear infinite;
}
.hub-orb-ring-1 { width: 44px; height: 44px; border-color: rgba(167,139,250,0.15); animation-duration: 12s; }
.hub-orb-ring-2 { width: 34px; height: 34px; border-color: rgba(244,114,182,0.2); animation-duration: 8s; animation-direction: reverse; }
.hub-orb-ring-3 { width: 24px; height: 24px; border-color: rgba(52,211,153,0.25); animation-duration: 5s; }

@keyframes hub-orb-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hub-orb-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 9px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  filter: drop-shadow(0 0 8px rgba(167,139,250,0.4));
  animation: hub-orb-pulse 3s ease-in-out infinite;
  /* hub-orb-spin 6s linear infinite — uncomment to enable 360 rotation */
  z-index: 2;
}

@keyframes hub-orb-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(167,139,250,0.3)); }
  50% { filter: drop-shadow(0 0 14px rgba(167,139,250,0.6)); }
}

@keyframes hub-genie-spin {
  from { transform: translate(-50%, -50%) rotateY(0deg); }
  to { transform: translate(-50%, -50%) rotateY(360deg); }
}

.hub-sat-wrap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: hub-orb-spin linear infinite;
}

.hub-sat-dot {
  border-radius: 50%;
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
}

.hub-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #f8fafc 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.hub-tagline {
  font-size: 12px;
  color: #94A3B8;
  margin-top: 1px;
  letter-spacing: 0.01em;
}

/* Header right */
.hub-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Stats */
.hub-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hub-stat {
  text-align: center;
  line-height: 1;
}

.hub-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.hub-stat-label {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hub-stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.12);
}

/* New Company button */
.hub-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 4px 18px rgba(108, 59, 238, 0.38);
  white-space: nowrap;
}

.hub-new-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108, 59, 238, 0.55);
  filter: brightness(1.08);
}

.hub-new-btn:active { transform: translateY(0); }

.hub-new-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 3px;
}

.hub-new-btn--lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 12px;
}

.hub-new-btn-plus {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  margin-right: 1px;
}

/* Main content area */
.hub-main {
  flex: 1;
  padding: 48px 32px 64px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* Section header */
.hub-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.hub-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
  margin: 0;
}

.hub-section-count {
  font-size: 12px;
  color: #64748B;
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════════════════════════
   Mini Agent Cards — Futuristic Command-Center Design
   ═══════════════════════════════════════════════════════════════ */
.mini-grid {
  display: grid;
  /* min(220px, 100%) prevents card overflow on viewports < 220px and
     gives a slightly more generous floor than 200px on phones. */
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  max-width: 1200px;
}

/* Force 2-up earlier (700px) — between 600 and 700 the auto-fill produces
   a "2.5 column" shimmer during resize and on common tablet widths. */
@media (max-width: 700px) {
  .mini-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 380px) {
  .mini-grid {
    grid-template-columns: 1fr;
  }
  /* At single-column on a tiny phone, the original 100px hero + 76px avatar
     looks heavy. Compress to give the body more vertical room. */
  .mini-card-hero { height: 84px; }
  .mini-card-avatar-outer { width: 64px; height: 64px; }
  .mini-card-holo-ring { width: 56px; height: 56px; }
}

/* ── Mini Card ── */
.mini-card {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  animation: hub-card-enter 0.45s cubic-bezier(0.16,1,0.3,1) both;
}

.mini-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  border-color: rgba(255,255,255,0.18);
}

/* Animated glow border */
.mini-card-glow {
  position: absolute;
  inset: -1px;
  border-radius: 15px;
  background: conic-gradient(from var(--glow-angle), #a78bfa, #6C3BEE, #2563EB, #059669, #DB2777, #a78bfa);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  pointer-events: none;
  animation: glow-spin 3s linear infinite;
  /* Pause spin when not hovered — the layer is invisible (opacity 0)
     but the animation keeps the GPU compositing. Compounds across N cards. */
  animation-play-state: paused;
}
.mini-card-glow::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 14px;
  background: rgba(8, 11, 20, 0.95);
}
.mini-card:hover .mini-card-glow {
  opacity: 0.7;
  animation-play-state: running;
}

/* Hero: colored wash + avatar */
.mini-card-hero {
  width: 100%;
  height: 100px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.mini-card-hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  transition: opacity 0.25s ease;
}
.mini-card:hover .mini-card-hero-bg {
  opacity: 0.24;
}

/* Bottom fade on hero */
.mini-card-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(to bottom, transparent, rgba(8,11,20,0.85));
  pointer-events: none;
}

/* Holographic ring around avatar */
.mini-card-holo-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  bottom: 8px;
  border: 1.5px solid rgba(167, 139, 250, 0.3);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.15), inset 0 0 10px rgba(167, 139, 250, 0.08);
  animation: holo-pulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.mini-card-avatar-outer {
  width: 76px;
  height: 76px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

/* Top accent bar */
.mini-card-color-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2;
}

/* ── Card body ── */
.mini-card-body {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.mini-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-card-name {
  font-family: 'Syne', var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  margin: 0;
}

.mini-card-rename-btn {
  background: none;
  border: none;
  color: rgba(248, 250, 252, 0.3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  opacity: 0;
}

.mini-card:hover .mini-card-rename-btn,
.mini-card-rename-btn:focus-visible {
  opacity: 1;
}

/* Touch devices have no hover — the rename pencil would be permanently
   invisible. Show it at reduced opacity instead so it's discoverable. */
@media (hover: none) and (pointer: coarse) {
  .mini-card-rename-btn {
    opacity: 0.55;
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
  }
}

.mini-card-rename-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

.mini-card-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  width: fit-content;
  letter-spacing: 0.02em;
}

/* Capabilities */
.mini-card-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1px;
}

.mini-card-capability {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #94A3B8;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s;
}
.mini-card:hover .mini-card-capability {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}

/* Manage Skills & Tools button */
.mini-card-manage-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  font-family: 'Syne', var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: rgba(160, 163, 255, 0.9);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  letter-spacing: 0.02em;
  margin-top: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mini-card-manage-btn:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c4b5fd;
}
.mini-card-manage-btn:active { transform: scale(0.98); }
.mini-card-manage-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}
.mini-card-manage-btn svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* Talk / Conversation button */
.mini-card-talk-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'Syne', var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: white;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.02em;
  transition: filter 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.mini-card-talk-btn:hover {
  filter: brightness(1.12);
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.mini-card-talk-btn:active { transform: scale(0.98); }
.mini-card-talk-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.mini-card-talk-arrow {
  font-size: 11px;
  transition: transform 0.2s ease;
}
.mini-card-talk-btn:hover .mini-card-talk-arrow {
  transform: translateX(3px);
}

/* Touch devices: ensure talk + manage buttons hit 44px tap target */
@media (hover: none) and (pointer: coarse) {
  .mini-card-talk-btn,
  .mini-card-manage-btn {
    min-height: var(--touch-min);
    font-size: 12px;
    padding: 10px 14px;
  }
}

/* ── Session view (legacy selector kept for activate/deactivate) ── */
[data-session-view] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
[data-session-view].active {
  opacity: 1;
  pointer-events: all;
}

/* ══════════════════════════════════════════════════════════════
   sv-* — Two-panel session UI (sidebar + chat)
══════════════════════════════════════════════════════════════ */
.sv-root {
  position: fixed;
  top: var(--topbar-h, 0);
  bottom: 0;
  left: 0;
  right: 0;
  padding-top: var(--safe-top, 0px);
  padding-left: var(--safe-left, 0px);
  padding-right: var(--safe-right, 0px);
  z-index: 100;
  display: flex;
  flex-direction: row;
  background: var(--color-bg);
  font-family: var(--font-sans);
}

/* ══ SIDEBAR ══════════════════════════════════════════════════ */
.sv-sidebar {
  width: 256px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 16px;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.015);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  gap: 0;
}
.sv-sidebar::-webkit-scrollbar { display: none; }

.sv-side-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  flex-shrink: 0;
}

.sv-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.sv-icon-btn:hover  { background: rgba(255,255,255,0.1); }
.sv-icon-btn:active { transform: scale(0.92); }

.sv-clear-btn { font-size: 14px; }
.sv-clear-btn:hover { background: rgba(239,68,68,0.15); color: #FCA5A5; }
.sv-back-btn { font-size: 17px; }
.sv-end-btn {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.2);
  color: #FCA5A5;
}
.sv-end-btn:hover { background: rgba(239,68,68,0.2); }

.sv-avatar-ring {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  padding: 4px;
  margin: 4px 0 10px;
  flex-shrink: 0;
  position: relative;
  transition: box-shadow 0.4s ease;
}
.sv-avatar-ring[data-state="speaking"] {
  box-shadow: 0 0 0 3px var(--agent-color, #666), 0 0 20px var(--agent-color, #666);
  animation: sv-ring-pulse 0.9s ease-in-out infinite alternate;
}
.sv-avatar-ring[data-state="listening"] {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
  animation: sv-ring-listen 1.2s ease-in-out infinite alternate;
}
.sv-avatar-ring[data-state="thinking"] {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
  animation: sv-ring-think 1.6s linear infinite;
}
@keyframes sv-ring-pulse {
  from { box-shadow: 0 0 0 2px var(--agent-color, #666), 0 0 12px var(--agent-color, #666); }
  to   { box-shadow: 0 0 0 4px var(--agent-color, #666), 0 0 28px var(--agent-color, #666); }
}
@keyframes sv-ring-listen {
  from { box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
  to   { box-shadow: 0 0 0 4px rgba(255,255,255,0.35); }
}
@keyframes sv-ring-think {
  from { box-shadow: 0 0 0 2px rgba(255,255,255,0.08) }
  to   { box-shadow: 0 0 0 2px rgba(255,255,255,0.18) }
}

.sv-avatar-wrap {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.sv-state-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
  flex-shrink: 0;
}
.sv-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
  animation: sv-dot-pulse 1.8s ease-in-out infinite;
}
.sv-state-dot--connecting { background: var(--color-warning); }
.sv-state-dot--listening  { background: #60A5FA; }
.sv-state-dot--thinking   { background: #A78BFA; animation: sv-dot-spin 1.4s linear infinite; }
.sv-state-dot--speaking   { background: var(--color-success); }
.sv-state-dot--error      { background: var(--color-error); animation: none; }
.sv-state-dot--off        { background: var(--color-text-muted); animation: none; }
.sv-state-dot--in-call    { background: #34d399; animation: sv-dot-pulse 1.2s ease-in-out infinite; }
@keyframes sv-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
@keyframes sv-dot-spin {
  to { transform: rotate(360deg); border-radius: 0; }
}

.sv-agent-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 18px;
}
.sv-agent-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sv-agent-role {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.9;
}
.sv-agent-tagline {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.4;
  margin-top: 2px;
}

.sv-side-section {
  width: 100%;
  padding: 0 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.sv-side-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.sv-caps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sv-cap-item {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding-left: 12px;
  position: relative;
  line-height: 1.5;
}
.sv-cap-item::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--color-text-muted);
}

.sv-tools-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sv-tool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.sv-tool-chip-icon { font-size: 14px; }

.sv-waveform {
  width: 200px;
  height: 40px;
  border-radius: var(--radius-sm);
  opacity: 0.75;
  margin: 4px 0 8px;
  flex-shrink: 0;
}

.sv-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  margin-top: auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.sv-mode-btn:hover { background: rgba(255,255,255,0.09); color: var(--color-text-primary); }
.sv-mode-btn--active {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.25);
  color: #FCA5A5;
  box-shadow: 0 0 16px rgba(239,68,68,0.15);
}
.sv-mode-btn-icon { font-size: 16px; }

/* ══ CHAT PANEL ════════════════════════════════════════════════ */
.sv-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sv-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 24px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.07) transparent;
}
.sv-messages::-webkit-scrollbar { width: 4px; }
.sv-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sv-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  pointer-events: none;
  user-select: none;
}
.sv-empty-icon { font-size: 40px; opacity: 0.5; }
.sv-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.sv-empty-hint {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Suggestion chips ─────────────────────────────────────────────────── */
.sv-suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  max-width: 520px;
  pointer-events: auto;
}
.sv-suggestion-chip {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  line-height: 1.3;
}
.sv-suggestion-chip:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--agent-color, rgba(255,255,255,0.25));
  color: rgba(255,255,255,0.95);
}
.sv-suggestion-chip:active {
  transform: scale(0.96);
}
/* Contextual chips (after AI response) — left-aligned in message flow */
.sv-suggestion-chips--ctx {
  justify-content: flex-start;
  padding: 4px 16px 12px;
  margin-top: 0;
  max-width: 100%;
}

.sv-load-older-btn {
  display: block;
  width: fit-content;
  margin: 0 auto 12px;
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sv-load-older-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.09);
  color: var(--color-text-primary);
  border-color: rgba(255,255,255,0.22);
}
.sv-load-older-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sv-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sv-msg--visible  { opacity: 1; transform: translateY(0); }
.sv-msg--user     { flex-direction: row-reverse; }
.sv-msg--mini     { flex-direction: row; }

.sv-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 1px;
  overflow: hidden;
}

.sv-msg-wrapper {
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sv-msg-wrapper.sv-msg--visible {
  opacity: 1;
  transform: translateY(0);
}
.sv-msg-wrapper > .sv-msg {
  opacity: 1;
  transform: none;
}

.sv-msg-timestamp {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary, rgba(255,255,255,0.5));
  margin-bottom: 4px;
  padding-left: 34px; /* avatar 26px + gap 8px */
}

.sv-bubble {
  max-width: min(68%, 520px);
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.sv-bubble--user {
  background: #2563EB;
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 10px rgba(37,99,235,0.3);
}
.sv-bubble--mini {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}
.sv-bubble--image-placeholder {
  padding: 12px;
  min-width: 220px;
}

.sv-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: middle;
  animation: sv-blink 0.7s step-end infinite;
}
@keyframes sv-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.sv-chat-image {
  display: block;
  max-width: 240px;
  margin-top: 8px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.sv-chat-image:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.sv-img-shimmer {
  width: 220px;
  height: 146px;
  border-radius: 10px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.1)  50%,
    rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: sv-shimmer 1.4s linear infinite;
}
@keyframes sv-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.sv-img-label {
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
  animation: sv-fade-pulse 1.4s ease-in-out infinite;
}
@keyframes sv-fade-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ============================================================
   MARKDOWN RENDERING IN CHAT BUBBLES
   ============================================================ */
.sv-bubble--rich .md-p {
  margin: 0 0 0.35em;
  line-height: 1.6;
}
.sv-bubble--rich .md-p:last-child {
  margin-bottom: 0;
}
.sv-bubble--rich strong {
  font-weight: 700;
  color: #fff;
}
.sv-bubble--mini.sv-bubble--rich strong {
  color: rgba(255, 255, 255, 0.95);
}

/* ── Save to Reports action bar ─────────────────────────────── */
.sv-msg-actions {
  display: flex;
  padding: 4px 0 0 44px; /* align with bubble (past avatar) */
}
.sv-save-report-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.sv-save-report-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}
.sv-save-report-btn:disabled {
  cursor: default;
  opacity: 0.7;
}
.sv-save-report-btn--saved {
  color: #4ade80;
  border-color: rgba(74,222,128,0.3);
}
.sv-bubble--rich em {
  font-style: italic;
}
.sv-bubble--rich .md-h1,
.sv-bubble--rich .md-h2,
.sv-bubble--rich .md-h3,
.sv-bubble--rich .md-h4 {
  font-weight: 700;
  margin: 0.6em 0 0.3em;
  line-height: 1.3;
}
.sv-bubble--rich .md-h1:first-child,
.sv-bubble--rich .md-h2:first-child,
.sv-bubble--rich .md-h3:first-child,
.sv-bubble--rich .md-h4:first-child {
  margin-top: 0;
}
.sv-bubble--rich .md-h1 { font-size: 1.15em; }
.sv-bubble--rich .md-h2 { font-size: 1.08em; }
.sv-bubble--rich .md-h3 { font-size: 1.02em; color: rgba(255,255,255,0.85); }
.sv-bubble--rich .md-h4 { font-size: 0.95em; color: rgba(255,255,255,0.7); }

.sv-bubble--rich .md-list {
  margin: 0.3em 0;
  padding-left: 1.4em;
}
.sv-bubble--rich .md-list li {
  margin-bottom: 0.2em;
  line-height: 1.5;
}
.sv-bubble--rich ol.md-list {
  list-style: decimal;
}
.sv-bubble--rich ul.md-list {
  list-style: disc;
}

.sv-bubble--rich .md-inline-code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.sv-bubble--user .md-inline-code {
  background: rgba(255, 255, 255, 0.18);
}

.sv-bubble--rich .md-code-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0.4em 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.5;
  /* pre-wrap so long lines/URLs don't push the chat bubble off-screen
     on mobile. Indentation is still preserved. */
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}
.sv-bubble--user .md-code-block {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.15);
}

.sv-bubble--rich .md-blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  padding-left: 10px;
  margin: 0.3em 0;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
}

.sv-bubble--rich .md-hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 0.5em 0;
}

.sv-bubble--rich .md-link {
  color: #60a5fa;
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.4);
}
.sv-bubble--rich .md-link:hover {
  text-decoration-color: #60a5fa;
}

/* ============================================================
   MARKDOWN IN WORKFLOW / REVIEW CONTEXTS
   ============================================================ */
.md-content .md-p {
  margin: 0 0 0.4em;
  line-height: 1.6;
}
.md-content .md-p:last-child { margin-bottom: 0; }
.md-content strong { font-weight: 700; color: rgba(255,255,255,0.92); }
.md-content em { font-style: italic; }

.md-content .md-h1,
.md-content .md-h2,
.md-content .md-h3,
.md-content .md-h4 {
  font-weight: 700;
  margin: 0.5em 0 0.25em;
  color: rgba(255,255,255,0.9);
}
.md-content .md-h1 { font-size: 1.1em; }
.md-content .md-h2 { font-size: 1.02em; }
.md-content .md-h3 { font-size: 0.95em; }
.md-content .md-h4 { font-size: 0.9em; }

.md-content .md-list {
  margin: 0.3em 0;
  padding-left: 1.4em;
}
.md-content .md-list li {
  margin-bottom: 0.2em;
  line-height: 1.5;
}
.md-content ol.md-list { list-style: decimal; }
.md-content ul.md-list { list-style: disc; }

.md-content .md-inline-code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.md-content .md-code-block {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0.3em 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

/* Long URLs / inline code in chat bubbles must wrap, not overflow */
.sv-msg-bubble,
.md-content .md-p {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sv-bubble--rich .md-link,
.md-content .md-link {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.md-content .md-blockquote {
  border-left: 3px solid rgba(255,255,255,0.15);
  padding-left: 10px;
  margin: 0.3em 0;
  color: rgba(255,255,255,0.55);
  font-style: italic;
}

.md-content .md-hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 0.5em 0;
}

.md-content .md-link {
  color: #60a5fa;
  text-decoration: underline;
}

.sv-error-banner {
  background: rgba(239,68,68,0.09);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #FCA5A5;
}

/* ── Input bar ── */
.sv-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Account for safe-area + iOS visual viewport keyboard offset.
     VoiceInterface sets --keyboard-offset on document.documentElement when
     the keyboard opens; without consuming it here, the input gets pushed
     under the keyboard in landscape on iPhone. */
  padding: 12px 16px calc(12px + var(--safe-bottom, 0px) + var(--keyboard-offset, 0px));
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.01);
  transition: padding-bottom var(--dur-fast) var(--ease-out);
}

.sv-text-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 16px;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.sv-text-input::placeholder { color: var(--color-text-muted); }
.sv-text-input:focus {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
}
.sv-text-input:disabled { opacity: 0.35; cursor: not-allowed; }

.sv-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--agent-color, #2563EB);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.sv-send-btn:hover:not(:disabled) {
  opacity: 0.85;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.sv-send-btn:active:not(:disabled) { transform: scale(0.9); }
.sv-send-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* ── Error / empty states ── */
.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: #FCA5A5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border-bright);
  border-top-color: var(--color-text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Switcher (Cmd+K) ── */
.mini-switcher-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.mini-switcher-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.mini-switcher {
  width: min(360px, 90vw);
  padding: 16px;
}
.mini-switcher-title {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.mini-switcher-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s ease;
  width: 100%;
  text-align: left;
}
.mini-switcher-item:hover, .mini-switcher-item.active {
  background: rgba(255,255,255,0.08);
}
.mini-switcher-item-avatar { width: 36px; height: 36px; flex-shrink: 0; }
.mini-switcher-item-name { font-size: 14px; font-weight: 600; }
.mini-switcher-item-role { font-size: 12px; color: var(--color-text-secondary); }

/* ═══════════════════════════════════════════════════════════════
   Company Grid + Cards — Futuristic Glass Design
   ═══════════════════════════════════════════════════════════════ */

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}


/* ── Card enter animation ── */
@keyframes hub-card-enter {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ── Company Card ── */
.hub-card {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  animation: hub-card-enter 0.45s cubic-bezier(0.16,1,0.3,1) both;
}

.hub-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  border-color: rgba(255,255,255,0.18);
}

/* ── Animated glow border (conic gradient, mask-composite) ── */
.hub-card-glow {
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: conic-gradient(from var(--glow-angle), #a78bfa, #6C3BEE, #2563EB, #059669, #DB2777, #a78bfa);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  pointer-events: none;
  animation: glow-spin 3s linear infinite;
}

.hub-card-glow::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  background: rgba(8, 11, 20, 0.95);
}

@keyframes glow-spin {
  to { --glow-angle: 360deg; }
}

.hub-card:hover .hub-card-glow {
  opacity: 0.7;
}

/* ── Card Hero ── */
.hub-card-hero {
  height: 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 1;
}

.hub-card-hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  transition: opacity 0.25s ease;
}

.hub-card:hover .hub-card-hero-bg {
  opacity: 0.26;
}

/* Bottom fade */
.hub-card-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, rgba(8,11,20,0.85));
  pointer-events: none;
}

.hub-card-hero-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.2;
  filter: blur(28px);
  pointer-events: none;
}

/* Holographic ring around emoji */
.hub-card-holo-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(167, 139, 250, 0.3);
  box-shadow:
    0 0 12px rgba(167, 139, 250, 0.15),
    inset 0 0 12px rgba(167, 139, 250, 0.08);
  animation: holo-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes holo-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.15), inset 0 0 12px rgba(167, 139, 250, 0.08);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.3), inset 0 0 16px rgba(167, 139, 250, 0.12);
  }
}

@keyframes emoji-float {
  0%, 100% { transform: translateY(0)   scale(1); }
  50%       { transform: translateY(-5px) scale(1.06); }
}

.hub-card-emoji {
  font-size: 40px;
  line-height: 1;
  position: relative;
  z-index: 2;
  animation: emoji-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  user-select: none;
}


/* ── Card Body ── */
.hub-card-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.hub-card-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
  line-height: 1.2;
  margin: 0;
}

/* ── Glass pill meta badges ── */
.hub-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hub-card-status-badge,
.hub-card-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #94A3B8;
  line-height: 1;
}

.hub-card-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hub-card-status-dot--active {
  background: #10b981;
  animation: status-pulse 2.4s ease-in-out infinite;
}

.hub-card-status-dot--empty {
  background: #64748B;
  animation: none;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  60%       { opacity: 0.85; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

.hub-card-count-icon {
  font-size: 12px;
  line-height: 1;
}

/* ── Avatar team strip ── */
.hub-card-team {
  display: flex;
  align-items: center;
}

.hub-card-team-scroll {
  display: flex;
  align-items: center;
}

.hub-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(8,11,20,0.9);
  flex-shrink: 0;
  margin-left: -8px;
  position: relative;
  background: rgba(255,255,255,0.05);
  transition: transform 0.2s ease;
}

.hub-card-avatar:first-child { margin-left: 0; }

.hub-card-team-scroll:hover .hub-card-avatar:hover {
  transform: translateY(-3px) scale(1.1);
  z-index: 10;
}

/* Overflow badge */
.hub-card-avatar-more {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
  flex-shrink: 0;
  margin-left: -8px;
}


/* ── Enter Workspace button ── */
.hub-card-enter-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-top: auto;
  transition: filter 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* The button background is set per-company (inline gradient). Some gradients
     have light pixels where pure white text drops below 3:1. Layered text
     shadow + a subtle dark overlay guarantee readability across every brand
     gradient without overriding the brand color. */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.hub-card-enter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.18) 100%);
  z-index: -1;
}

.hub-card-enter-btn:hover {
  filter: brightness(1.12);
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.hub-card-enter-btn:active { transform: scale(0.98); }

.hub-card-enter-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.hub-card-enter-arrow {
  font-size: 16px;
  transition: transform 0.2s ease;
}
.hub-card-enter-btn:hover .hub-card-enter-arrow {
  transform: translateX(3px);
}

/* ── Delete button on card ── */
.hub-card-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease,
              transform 0.2s ease,
              color 0.15s ease,
              background 0.15s ease;
}

/* Visible on card hover OR focus-visible */
.hub-card:hover .hub-card-delete-btn,
.hub-card-delete-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.hub-card-delete-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.hub-card-delete-btn:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.35);
}

.hub-card-delete-btn:active {
  transform: scale(0.92);
}

/* ── Hub empty state ── */
@keyframes empty-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.hub-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 32px;
  gap: 20px;
  animation: hub-card-enter 0.5s ease both;
}

.hub-empty-icon-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: empty-float 4s ease-in-out infinite;
  /* content-visibility:auto + contain pause animation when offscreen
     in modern browsers, matching IntersectionObserver behavior cheaply. */
  content-visibility: auto;
  contain: layout paint;
}

.hub-empty-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(108,59,238,0.25);
  animation: ring-expand 3s ease-out infinite;
  contain: paint;
}
.hub-empty-ring.ring-1 { width: 96px;  height: 96px;  animation-delay: 0s; }
.hub-empty-ring.ring-2 { width: 130px; height: 130px; animation-delay: 0.8s; }

@keyframes ring-expand {
  0%   { opacity: 0.6; transform: scale(0.85); }
  100% { opacity: 0;   transform: scale(1.15); }
}

.hub-empty-icon {
  font-size: 52px;
  line-height: 1;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 16px rgba(108,59,238,0.4));
}

.hub-empty-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #f8fafc;
  margin: 0;
}

.hub-empty-desc {
  font-size: 15px;
  color: #94A3B8;
  max-width: 380px;
  line-height: 1.65;
  margin: 0;
}

/* Legacy class used by workspace empty CTAs */
.company-hub-empty-cta {
  margin-top: 4px;
  padding: 11px 26px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color: white;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 4px 18px rgba(108,59,238,0.35);
}
.company-hub-empty-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108,59,238,0.5);
  filter: brightness(1.08);
}

/* ── Live region for screen readers ── */
.hub-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Reduced Motion — Disable all hub animations/transitions
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .hub-bg::before,
  .hub-logo-star,
  .hub-logo-dot,
  .hub-card-emoji,
  .hub-card-holo-ring,
  .hub-empty-icon-wrap,
  .hub-empty-ring,
  .hub-card-status-dot--active {
    animation: none;
  }

  .hub-header::after {
    animation: none;
    background: rgba(167, 139, 250, 0.2);
  }

  .hub-card {
    animation: none;
    transition: none;
  }

  .hub-card-glow {
    animation: none;
    display: none;
  }

  .hub-card-enter-btn,
  .hub-card-delete-btn,
  .hub-new-btn,
  .hub-card-hero-bg {
    transition: none;
  }

  .hub-empty-state {
    animation: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Focus-visible styles for all hub interactive elements
   ═══════════════════════════════════════════════════════════════ */
.hub-card-enter-btn:focus-visible,
.hub-card-delete-btn:focus-visible,
.hub-new-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   Workspace — Futuristic Command-Center Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Workspace header ── */
.workspace-header {
  gap: 16px;
  padding: 20px 32px;
}

/* Scanning line on workspace header (matches hub header) */
.workspace-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #a78bfa44 20%,
    #a78bfa 50%,
    #a78bfa44 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: scan-line 4s linear infinite;
}

.workspace-back-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.workspace-back-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.workspace-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Holographic ring around workspace emoji */
.workspace-emoji-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(167, 139, 250, 0.3);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.12), inset 0 0 10px rgba(167, 139, 250, 0.06);
  animation: holo-pulse 3s ease-in-out infinite;
  background: rgba(255,255,255,0.04);
}

.workspace-emoji {
  font-size: 22px;
  line-height: 1;
}

.workspace-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.workspace-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Critical: without min-width:0 the flex item won't shrink past its
     content size, which forces ellipsis even when there's no real overflow.
     With this, the name truncates only when it actually has to. */
  min-width: 0;
  flex: 1;
}

@media (max-width: 480px) {
  /* Shrink the emoji ring + name slightly so a 12-char company name doesn't
     get truncated to "My Comp…" on a 375px iPhone. */
  .workspace-emoji-ring { width: 36px; height: 36px; }
  .workspace-name { font-size: 16px; }
}

.workspace-team-count {
  font-size: 11px;
  color: #64748B;
  letter-spacing: 0.02em;
}

/* Action buttons */
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
  white-space: nowrap;
  position: relative;
}

.workspace-action-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.95);
  border-color: rgba(255,255,255,0.18);
}
.workspace-action-btn:active { transform: scale(0.97); }
.workspace-action-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.workspace-action-btn-icon {
  font-size: 14px;
  line-height: 1;
}

/* Add Mini button — accent style */
.workspace-add-btn {
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(108, 59, 238, 0.3);
}

/* Workflows button — filled accent style */
.workspace-workflows-btn {
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(108, 59, 238, 0.3);
}
.workspace-workflows-btn:hover {
  background: linear-gradient(135deg, #7c4dfe 0%, #a855f7 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(108, 59, 238, 0.45);
}
.workflows-pending-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #1a1a2e;
  animation: dot-pulse 1.5s ease-in-out infinite;
}
.workspace-add-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(108, 59, 238, 0.45);
  color: #fff;
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  border-color: transparent;
}

/* Voice toggle button */
.workspace-voice-toggle {
  border-color: rgba(239,68,68,0.3);
  color: rgba(239,68,68,0.8);
}
.workspace-voice-toggle:hover {
  border-color: rgba(239,68,68,0.5);
  color: rgba(239,68,68,1);
  background: rgba(239,68,68,0.08);
}
.workspace-voice-toggle.active {
  border-color: rgba(34,197,94,0.4);
  color: rgba(34,197,94,0.9);
  background: rgba(34,197,94,0.08);
}
.workspace-voice-toggle.active:hover {
  border-color: rgba(34,197,94,0.6);
  color: rgba(34,197,94,1);
  background: rgba(34,197,94,0.12);
}

/* Settings dropdown */
.workspace-settings-wrap {
  position: relative;
}

.workspace-settings-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.15s, color 0.15s;
}
.workspace-settings-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
}
.workspace-settings-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.workspace-settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(15, 15, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  display: none;
  z-index: 50;
}

.workspace-settings-menu.open {
  display: block;
}

.workspace-settings-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  transition: background 0.1s ease, color 0.1s ease;
}

.workspace-settings-menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.workspace-settings-menu-item.danger {
  color: #FCA5A5;
}
.workspace-settings-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* ── Hamburger menu ── */
.workspace-hamburger-wrap {
  position: relative;
}

.workspace-hamburger-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.workspace-hamburger-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
}
.workspace-hamburger-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}
@media (hover: none) and (pointer: coarse) {
  .workspace-hamburger-btn { width: 44px; height: 44px; }
}

.workspace-hamburger-btn .hamburger-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  background: #f97316;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.3);
  animation: dot-pulse 1.5s ease-in-out infinite;
}

/* Backdrop overlay — used on mobile to dim behind the menu and capture taps */
.workspace-hamburger-backdrop {
  display: none;
}

.workspace-hamburger-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(15, 15, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  display: none;
  z-index: 50;
  /* Cap to viewport so even with all sections expanded, menu can scroll */
  max-height: calc(100dvh - var(--topbar-h, 68px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.workspace-hamburger-menu.open {
  display: block;
}

/* Section labels — split the 11 items into scannable groups */
.workspace-hamburger-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 10px 12px 4px;
  user-select: none;
}
.workspace-hamburger-section:first-child {
  padding-top: 6px;
}

.workspace-hamburger-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  /* 12px vertical padding + 13px line-height ≈ 44px tap target without
     forcing min-height (which can fight section labels above each item). */
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  position: relative;
  min-height: var(--touch-min);
}
.workspace-hamburger-menu-item:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: -2px;
}
.workspace-hamburger-menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.workspace-hamburger-menu-item .hamburger-item-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Voice active state: green left border + green tint */
.workspace-hamburger-menu-item.active {
  border-left: 2px solid rgba(34,197,94,0.7);
  background: rgba(34,197,94,0.06);
  color: rgba(34,197,94,0.9);
}
.workspace-hamburger-menu-item.active:hover {
  background: rgba(34,197,94,0.1);
  color: rgba(34,197,94,1);
}

/* Danger (delete) */
.workspace-hamburger-menu-item.danger {
  color: #FCA5A5;
}
.workspace-hamburger-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.workspace-hamburger-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 8px;
}

/* Inline PAPER/LIVE badge inside trading menu item */
.workspace-hamburger-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.workspace-hamburger-badge.paper {
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid rgba(5, 150, 105, 0.3);
  color: #34D399;
}
.workspace-hamburger-badge.live {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}

/* Activity item notification dot */
.workspace-hamburger-menu-item .hamburger-item-dot {
  width: 6px;
  height: 6px;
  background: #f97316;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── Workspace section header ── */
.workspace-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.workspace-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
  margin: 0;
}

.workspace-section-count {
  font-size: 12px;
  color: #64748B;
  letter-spacing: 0.01em;
}

/* ── Workspace empty state ── */
.workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 32px;
  gap: 20px;
  animation: hub-card-enter 0.5s ease both;
}

.workspace-empty-icon-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: empty-float 4s ease-in-out infinite;
}

.workspace-empty-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(108,59,238,0.25);
  animation: ring-expand 3s ease-out infinite;
}
.workspace-empty-ring.ring-1 { width: 96px;  height: 96px;  animation-delay: 0s; }
.workspace-empty-ring.ring-2 { width: 130px; height: 130px; animation-delay: 0.8s; }

.workspace-empty-icon {
  font-size: 52px;
  line-height: 1;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 16px rgba(108,59,238,0.4));
}

.workspace-empty h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.workspace-empty p {
  font-size: 15px;
  color: #94A3B8;
  max-width: 340px;
  line-height: 1.6;
  margin: 0;
}

/* ── Workspace reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .workspace-header::after {
    animation: none;
    background: rgba(167, 139, 250, 0.2);
  }
  .workspace-emoji-ring {
    animation: none;
  }
  .mini-card {
    animation: none;
    transition: none;
  }
  .mini-card-glow {
    animation: none;
    display: none;
  }
  .mini-card-holo-ring {
    animation: none;
  }
  .mini-card-talk-btn,
  .workspace-action-btn,
  .workspace-back-btn {
    transition: none;
  }
  .workspace-empty {
    animation: none;
  }
  .workspace-empty-icon-wrap,
  .workspace-empty-ring {
    animation: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Mini Selector — Team Builder Modal
   ═══════════════════════════════════════════════════════════════ */

.mini-selector-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mini-selector-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Modal panel entrance */
@keyframes selector-enter {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mini-selector {
  width: 540px;
  max-width: calc(100vw - 32px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(12, 14, 24, 0.96);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05) inset;
  backdrop-filter: blur(24px) saturate(180%);
  animation: selector-enter 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

/* ── Header ── */
.mini-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  position: relative;
}

/* Scanning line on selector header */
.mini-selector-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #a78bfa33 30%,
    #a78bfa88 50%,
    #a78bfa33 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: scan-line 4s linear infinite;
}

.mini-selector-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-selector-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

.mini-selector-subtitle {
  font-size: 12px;
  color: #64748B;
}

.mini-selector-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.15s, color 0.15s;
}
.mini-selector-close:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
}
.mini-selector-close:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* ── Agent list ── */
.mini-selector-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.mini-selector-list::-webkit-scrollbar { width: 4px; }
.mini-selector-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* ── Agent row ── */
@keyframes row-enter {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.mini-selector-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.2s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              transform 0.15s ease;
  position: relative;
  user-select: none;
  animation: row-enter 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.mini-selector-row:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  transform: translateX(2px);
}

.mini-selector-row:active {
  transform: scale(0.995);
}

.mini-selector-row:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* Selected state */
.mini-selector-row.in-team {
  background: rgba(108, 59, 238, 0.08);
  border-color: rgba(108, 59, 238, 0.30);
  box-shadow: 0 0 20px rgba(108, 59, 238, 0.08), inset 0 0 0 1px rgba(108, 59, 238, 0.05);
}

.mini-selector-row.in-team:hover {
  background: rgba(108, 59, 238, 0.12);
  border-color: rgba(108, 59, 238, 0.40);
}

/* ── Left accent bar ── */
.mini-selector-accent {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 40px;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.mini-selector-row.in-team .mini-selector-accent {
  opacity: 1;
}

/* ── Avatar with ring ── */
.mini-selector-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.mini-selector-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.08);
  transition: border-color 0.25s ease;
}

.mini-selector-row.in-team .mini-selector-avatar {
  border-color: rgba(108, 59, 238, 0.5);
}

/* Holographic ring on selected avatar */
.mini-selector-avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(167, 139, 250, 0.0);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  pointer-events: none;
}

.mini-selector-row.in-team .mini-selector-avatar-ring {
  border-color: rgba(167, 139, 250, 0.3);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.12);
  animation: holo-pulse 3s ease-in-out infinite;
}

/* ── Info block ── */
.mini-selector-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-selector-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-selector-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #f8fafc;
}

.mini-selector-role {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.mini-selector-tagline {
  font-size: 12px;
  color: #94A3B8;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-selector-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.mini-selector-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #94A3B8;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}
.mini-selector-row.in-team .mini-selector-pill {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

/* ── Toggle indicator ── */
.mini-selector-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              border-color 0.2s ease;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.15);
}

.mini-selector-row.in-team .mini-selector-toggle {
  background: rgba(108, 59, 238, 0.25);
  border-color: rgba(108, 59, 238, 0.5);
  transform: scale(1.1);
}

/* ── Footer ── */
.mini-selector-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.mini-selector-team-summary {
  flex: 1;
  font-size: 12px;
  color: #64748B;
}

.mini-selector-team-summary strong {
  color: #a78bfa;
  font-weight: 700;
}

.mini-selector-cancel-btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #94A3B8;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  transition: background 0.15s, color 0.15s;
}
.mini-selector-cancel-btn:hover {
  background: rgba(255,255,255,0.10);
  color: #f8fafc;
}
.mini-selector-cancel-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

.mini-selector-done-btn {
  padding: 9px 22px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(108, 59, 238, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.mini-selector-done-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 59, 238, 0.45);
  filter: brightness(1.06);
}
.mini-selector-done-btn:active { transform: translateY(0); }
.mini-selector-done-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .mini-selector {
    animation: none;
  }
  .mini-selector-header::after {
    animation: none;
    background: rgba(167, 139, 250, 0.15);
  }
  .mini-selector-row {
    animation: none;
    transition: none;
  }
  .mini-selector-toggle {
    transition: none;
  }
  .mini-selector-avatar-ring {
    animation: none;
    transition: none;
  }
}

/* ── Create Company Modal ── */
/* Legacy modal overlay (kept for compat) */
.create-company-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.create-company-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.create-company-modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  padding: 28px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.create-company-overlay.active .create-company-modal {
  transform: scale(1);
}

/* ── Full-screen Create Company (FRE-style) ─────────────────── */

.create-company-fullscreen {
  display: none;
  z-index: 9000;
}

.create-company-fullscreen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.create-company-inner {
  position: relative;
  width: 100%;
  max-width: 720px;
  padding: 60px 48px;
  z-index: 9002;
}

.ccf-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.ccf-close:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}

.ccf-content {
  display: flex;
  flex-direction: column;
}

.ccf-subtitle {
  font-size: 15px;
  color: rgba(237,237,255,0.5);
  margin-bottom: 24px;
  font-weight: 300;
  line-height: 1.5;
}

.ccf-cta {
  align-self: flex-start;
  margin-top: 24px;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.01em;
}

.ccf-cta:hover:not(:disabled) {
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139,92,246,0.3);
}

.ccf-cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ccf-skip {
  align-self: flex-start;
  margin-top: 16px;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.ccf-skip:hover {
  color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
  .create-company-inner {
    padding: 40px 20px;
  }
  .ccf-cta {
    width: 100%;
    text-align: center;
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.modal-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.modal-input:focus {
  border-color: var(--color-accent);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.emoji-option {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: border-color 0.1s ease, transform 0.1s ease;
  cursor: pointer;
}

.emoji-option:hover {
  transform: scale(1.1);
}

.emoji-option.selected {
  border-color: var(--color-accent);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.color-swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.1s ease, transform 0.1s ease;
}

.color-swatch:hover {
  transform: scale(1.05);
}

.color-swatch.selected {
  border-color: white;
  transform: scale(1.1);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.modal-cancel-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.modal-create-btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--color-accent);
  color: white;
  transition: opacity 0.15s ease;
}

.modal-create-btn:hover:not(:disabled) { opacity: 0.9; }

.modal-create-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

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

.confirm-modal {
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 28px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.confirm-icon {
  font-size: 40px;
  line-height: 1;
}

.confirm-modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.confirm-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  max-width: 300px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.confirm-delete-btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
  transition: background 0.15s ease;
}

.confirm-delete-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* ── Two-step delete modal ────────────────────────────────────────────────── */
.hub-delete-overlay {
  /* inherits .confirm-overlay positioning */
  animation: fade-in 0.18s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.hub-delete-modal {
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 28px 28px 24px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: modal-in 0.22s cubic-bezier(0.16,1,0.3,1) both;
}

/* Step 2 adds a red border tint */
.hub-delete-modal--step2 {
  border-color: rgba(239, 68, 68, 0.3);
  animation: modal-in 0.18s cubic-bezier(0.16,1,0.3,1) both;
}

.hub-delete-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fca5a5;
  flex-shrink: 0;
}

.hub-delete-icon--danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  font-size: 22px;
  line-height: 1;
}

.hub-delete-title {
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin: 0;
}

.hub-delete-desc {
  font-size: 13.5px;
  color: #94A3B8;
  line-height: 1.6;
  margin: 0;
}

.hub-delete-desc strong {
  color: #cbd5e1;
  font-weight: 600;
}

.hub-delete-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.hub-delete-cancel {
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  color: #94A3B8;
}

.hub-delete-continue {
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #f8fafc;
  transition: background 0.15s ease;
}

.hub-delete-continue:hover {
  background: rgba(255,255,255,0.14);
}

/* Final destructive action — red, prominent */
.hub-delete-confirm {
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hub-delete-confirm:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.65);
}

/* ── Hub Footer ──────────────────────────────────────────────────── */
.hub-footer {
  padding: 24px 32px;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center;
  flex-shrink: 0;
}
.hub-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.hub-footer-link {
  font-size: 0.75rem;
  color: var(--color-text-tertiary, rgba(255,255,255,.35));
  text-decoration: none;
  transition: color .15s;
}
.hub-footer-link:hover {
  color: var(--color-accent, #a78bfa);
}
.hub-footer-sep {
  font-size: 0.65rem;
  color: rgba(255,255,255,.15);
  user-select: none;
}
.hub-footer-copy {
  font-size: 0.68rem;
  color: rgba(255,255,255,.25);
}

/* ═══════════════════════════════════════════════════════════════
   Mobile Responsive Breakpoints
   ═══════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 768px) ── */
@media (max-width: 768px) {
  body.has-topbar { --topbar-h: 50px; }

  /* Header: stack logo and actions vertically */
  .hub-header {
    flex-wrap: wrap;
    padding: calc(14px + var(--safe-top, 0px)) 16px 14px;
    gap: 12px;
  }

  .hub-logo-area {
    gap: 10px;
  }

  .hub-logo {
    font-size: 17px;
  }

  .hub-tagline {
    font-size: 11px;
  }

  .hub-header-right {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hub-stats {
    gap: 10px;
  }

  .hub-stat-value {
    font-size: 16px;
  }

  .hub-stat-label {
    font-size: 10px;
  }

  .hub-stat-divider {
    height: 22px;
  }

  .hub-new-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Main content */
  .hub-main {
    padding: 28px 16px 40px;
  }

  .hub-section-header {
    margin-bottom: 16px;
  }

  /* Grids: single column */
  .hub-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .mini-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  /* Compact mini cards on tablet */
  .mini-card-hero {
    height: 72px;
  }

  .mini-card-avatar-outer {
    width: 56px;
    height: 56px;
  }

  .mini-card-holo-ring {
    width: 48px;
    height: 48px;
  }

  .mini-card-body {
    padding: 8px 10px 10px;
    gap: 5px;
  }

  .mini-card-name {
    font-size: 12px;
  }

  .mini-card-capabilities {
    display: none;
  }

  .mini-card-tools {
    display: none;
  }

  .mini-card-talk-btn {
    padding: 6px 10px;
    font-size: 10px;
  }

  /* Footer */
  .hub-footer {
    padding: 20px 16px;
  }

  .hub-footer-links {
    gap: 6px;
  }

  /* Workspace header — hamburger is fixed bottom sheet, overflow safe */
  .workspace-header {
    padding: 14px 16px;
    gap: 10px;
    overflow: hidden;
  }

  .workspace-back-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .workspace-name {
    font-size: 16px;
  }

  .workspace-actions {
    gap: 6px;
    flex-wrap: wrap;
    overflow: hidden;
  }

  .workspace-action-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Hamburger menu: bottom sheet on tablet (prevents top clipping) */
  .workspace-hamburger-menu.open {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    width: 100% !important;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    z-index: 9999;
    padding: 12px 10px calc(env(safe-area-inset-bottom, 8px) + 10px);
    animation: slide-up-menu 0.2s ease-out;
    background: rgba(12, 12, 24, 1);
    backdrop-filter: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
  }

  .workspace-hamburger-menu.open::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 10px;
  }

  /* Backdrop visible on tablet */
  .workspace-hamburger-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
  }

  /* Voice/Chat: sidebar collapses */
  .sv-root {
    flex-direction: column;
  }

  .sv-sidebar {
    width: 100%;
    max-height: 70px;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px;
    gap: 10px;
    overflow-y: hidden;
  }

  .sv-avatar-ring {
    width: 64px;
    height: 64px;
    margin: 0;
  }

  .sv-agent-info {
    text-align: left;
    align-items: flex-start;
  }

  .sv-agent-name {
    font-size: 15px;
  }

  .sv-agent-role {
    font-size: 11px;
  }

  .sv-agent-tagline,
  .sv-side-section,
  .sv-waveform {
    display: none;
  }

  .sv-mode-btn {
    width: auto;
    padding: 8px 14px;
    font-size: 12px;
    margin-top: 0;
  }

  .sv-messages {
    padding: 16px 12px 8px;
  }

  .sv-input-bar {
    padding: 8px 12px;
  }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  body.has-topbar { --topbar-h: 46px; }

  /* Header: full stack layout */
  .hub-header {
    padding: calc(12px + var(--safe-top, 0px)) 12px 12px;
    gap: 10px;
  }

  .hub-logo-area {
    width: 100%;
    justify-content: flex-start;
  }

  .hub-header-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .hub-stats {
    gap: 8px;
  }

  .hub-stat-value {
    font-size: 15px;
  }

  .hub-stat-label {
    font-size: 10px;
  }

  .hub-new-btn {
    padding: 7px 12px;
    font-size: 12px;
    gap: 5px;
    min-height: 44px;
  }

  .hub-new-btn-plus {
    font-size: 15px;
  }

  /* Main content: tighter spacing */
  .hub-main {
    padding: 20px calc(12px + var(--safe-left, 0px)) 32px calc(12px + var(--safe-right, 0px));
  }

  .hub-section-title {
    font-size: 16px;
  }

  .hub-section-count {
    font-size: 11px;
  }

  /* Mini card grid: always single column, tight gap for compact cards */
  .mini-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Company card adjustments */
  .hub-card {
    border-radius: 12px;
  }

  /* Footer: smaller text, tighter spacing */
  .hub-footer {
    padding: 16px 12px;
  }

  .hub-footer-sep {
    display: none;
  }

  .hub-footer-links {
    gap: 4px 12px;
  }

  /* Workspace: compact header — hamburger is fixed bottom sheet so overflow safe */
  .workspace-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    overflow: hidden;
  }

  .workspace-emoji-ring {
    width: 36px;
    height: 36px;
  }

  .workspace-emoji {
    font-size: 18px;
  }

  .workspace-name {
    font-size: 14px;
  }

  .workspace-team-count {
    font-size: 10px;
  }

  /* Actions row — hamburger is now fixed bottom sheet, overflow safe */
  .workspace-actions {
    width: 100%;
    justify-content: space-between;
    overflow: hidden;
  }

  .workspace-action-btn {
    padding: 10px 12px;
    font-size: 11px;
    flex-shrink: 0;
    min-height: 44px;
  }

  /* Hide button label text on small screens, keep icon */
  .workspace-action-btn-label {
    display: none;
  }

  /* Hamburger dropdown: bottom sheet on phones */
  .workspace-hamburger-menu.open {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    width: 100% !important;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    z-index: 9999;
    padding: 12px 10px calc(env(safe-area-inset-bottom, 8px) + 10px);
    animation: slide-up-menu 0.2s ease-out;
    background: rgba(12, 12, 24, 1);
    backdrop-filter: none;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
  }

  /* Backdrop visible on phones */
  .workspace-hamburger-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
  }

  /* Drag handle indicator at top of bottom sheet */
  .workspace-hamburger-menu.open::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto 10px;
  }

  /* Larger touch targets for mobile menu items */
  .workspace-hamburger-menu-item {
    padding: 12px 14px;
    font-size: 15px;
    gap: 12px;
  }

  .workspace-hamburger-menu-item .hamburger-item-icon {
    font-size: 18px;
  }

  .workspace-hamburger-divider {
    margin: 6px 10px;
  }

  /* Create Company modal → bottom sheet */
  .create-company-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    max-height: 85dvh;
    padding-bottom: calc(16px + var(--safe-bottom, 0px));
    animation: slide-up-menu 0.25s ease-out;
  }

  .sv-avatar-ring {
    width: 44px;
    height: 44px;
  }

  .sv-agent-name {
    font-size: 14px;
  }

  .sv-agent-role {
    font-size: 10px;
  }

  .sv-side-nav {
    padding: 6px 10px;
  }

  .sv-state-chip {
    font-size: 10px;
    margin-bottom: 0;
  }

  .sv-messages {
    padding: 10px 10px 6px;
    gap: 6px;
  }

  /* Message bubbles */
  .sv-msg-bubble {
    max-width: 92%;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.45;
  }

  .sv-input-bar {
    padding: 6px 10px calc(6px + var(--safe-bottom, 0px) + var(--keyboard-offset, 0px));
    gap: 8px;
  }

  .sv-text-input {
    padding: 10px 14px;
    font-size: 16px;
  }

  .sv-empty-state {
    padding: 20px 16px;
  }

  .sv-empty-icon { font-size: 32px; }
  .sv-empty-title { font-size: 15px; }
  .sv-empty-hint { font-size: 12px; }

  .sv-suggestion-chips {
    gap: 6px;
    max-width: 100%;
  }

  .sv-suggestion-chip {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Code blocks: prevent horizontal page scroll, wrap on mobile */
  .sv-bubble--rich .md-code-block,
  .md-content .md-code-block {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
  }

  /* Sidebar: minimal strip on mobile — hide nav/role, keep avatar + name */
  .sv-sidebar {
    max-height: 52px;
    padding: 8px 12px;
    gap: 10px;
  }

  .sv-side-nav {
    display: none;
  }

  .sv-agent-role {
    display: none;
  }

  .sv-avatar-ring {
    width: 40px;
    height: 40px;
  }

  /* Mini card: compact horizontal layout on small phones */
  .mini-card {
    border-radius: 12px;
    flex-direction: row;
    align-items: center;
  }

  .mini-card-hero {
    width: 72px;
    height: auto;
    min-height: 72px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 12px 0 0 12px;
  }

  .mini-card-hero::after {
    display: none;
  }

  .mini-card-avatar-outer {
    width: 48px;
    height: 48px;
  }

  .mini-card-holo-ring {
    width: 44px;
    height: 44px;
    bottom: auto;
  }

  .mini-card-color-bar {
    width: 3px;
    height: 100%;
    right: auto;
    bottom: 0;
  }

  .mini-card-body {
    padding: 10px 14px;
    gap: 4px;
    flex: 1;
    min-width: 0;
  }

  .mini-card-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mini-card-role-badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  .mini-card-capabilities {
    display: none;
  }

  .mini-card-tools {
    display: none;
  }

  .mini-card-talk-btn {
    padding: 8px 12px;
    min-height: 44px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 36px;
  }

  /* Workspace name: truncate */
  .workspace-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  /* Confirm/Delete modals → bottom sheet */
  .confirm-modal,
  .hub-delete-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + var(--safe-bottom, 0px));
    animation: slide-up-menu 0.25s ease-out;
  }

  /* Mini switcher */
  .mini-switcher {
    max-height: 200px;
  }
}

/* ── Extra Small Mobile (≤ 375px) ── */
@media (max-width: 375px) {
  body.has-topbar { --topbar-h: 42px; }

  .hub-header {
    padding: calc(10px + var(--safe-top, 0px)) 10px 10px;
    gap: 8px;
  }

  .hub-logo { font-size: 15px; }
  .hub-tagline { font-size: 10px; }

  .hub-stat-value { font-size: 14px; }
  .hub-stat-label { font-size: 9px; letter-spacing: 0.3px; }

  .hub-main {
    padding: 16px 10px 28px;
  }

  .hub-section-title { font-size: 15px; }

  .hub-footer {
    padding: 14px 10px calc(14px + var(--safe-bottom, 0px));
  }

  .hub-footer-links { font-size: 11px; }

  /* Workspace */
  .workspace-header { padding: 8px 10px; }
  .workspace-emoji-ring { width: 32px; height: 32px; }
  .workspace-emoji { font-size: 16px; }
  .workspace-name { font-size: 13px; max-width: 120px; }

  /* Voice/Chat — minimal sidebar strip */
  .sv-sidebar {
    max-height: 48px;
    padding: 6px 10px;
  }

  .sv-avatar-ring { width: 34px; height: 34px; }
  .sv-agent-name { font-size: 13px; }

  .sv-messages { padding: 8px 8px 4px; }

  .sv-msg-bubble {
    max-width: 94%;
    padding: 8px 10px;
    font-size: 14px;
  }

  .sv-input-bar {
    padding: 4px 8px calc(4px + var(--safe-bottom, 0px));
    gap: 6px;
  }

  .sv-text-input { padding: 9px 12px; }

  .sv-empty-state { padding: 16px 12px; }
  .sv-empty-icon { font-size: 28px; }
  .sv-empty-title { font-size: 14px; }

  .sv-suggestion-chips { gap: 5px; }
  .sv-suggestion-chip { font-size: 11px; padding: 7px 10px; }

  /* Font legibility on small phones */
  .hub-footer-links { font-size: 12px; }
  .hub-stat-label { font-size: 10px; }

  /* Hamburger: solid background on 375px too */
  .workspace-hamburger-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
  }

  .workspace-hamburger-menu.open {
    background: rgba(12, 12, 24, 1);
    backdrop-filter: none;
    max-height: 65vh;
    max-height: 65dvh;
  }

  /* Mini cards */
  .mini-card-hero { width: 64px; min-height: 64px; }
  .mini-card-avatar-outer { width: 42px; height: 42px; }
  .mini-card-body { padding: 8px 10px; }
  .mini-card-name { font-size: 13px; }
  .mini-card-talk-btn { font-size: 11px; padding: 6px 10px; }
}

/* ── Touch device: disable hover transforms + hide glow ── */
@media (hover: none) and (pointer: coarse) {
  .hub-card {
    transition: none;
  }
  .hub-card:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(255,255,255,0.10);
  }
  .hub-card:hover .hub-card-glow {
    opacity: 0;
  }
  .hub-card:hover .hub-card-hero-bg {
    opacity: 0.18;
  }
  .hub-card-enter-btn {
    transition: none;
  }
  .hub-card-enter-btn:hover {
    filter: none;
    transform: none;
    box-shadow: none;
  }
  .hub-card-enter-btn:hover .hub-card-enter-arrow {
    transform: none;
  }
  .hub-card-delete-btn {
    opacity: 1;
    transform: scale(1);
  }
  .hub-card:hover .hub-card-delete-btn {
    opacity: 1;
  }
  .hub-card-delete-btn:hover {
    color: inherit;
    background: transparent;
    border-color: transparent;
  }
  .hub-card-team-scroll:hover .hub-card-avatar:hover {
    transform: none;
  }
  .mini-card:hover {
    transform: none;
    box-shadow: none;
  }
  .hub-card-glow,
  .mini-card-glow {
    display: none;
  }
  .mini-card-holo-ring {
    display: none;
  }
}

@keyframes slide-up-menu {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── Mini card working indicator ── */
.mini-card-working {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 16, 24, 0.88);
  color: #a78bfa;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  z-index: 10;
  border: 1px solid rgba(167, 139, 250, 0.25);
  letter-spacing: 0.3px;
}
.mini-card-working-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a78bfa;
  animation: workingDotBounce 1.4s ease-in-out infinite;
}
.mini-card-working-dot:nth-child(2) { animation-delay: 0.2s; }
.mini-card-working-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes workingDotBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ── Mini card notification dot ── */
.mini-card-notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg-primary, #080B14);
  z-index: 10;
  animation: notifDotPulse 2s ease-in-out infinite;
}
@keyframes notifDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ── Workspace toast ── */
.workspace-toast {
  position: fixed;
  /* Clear iPhone home indicator. Without safe-area, toast clips behind the
     gesture bar on notched devices. */
  bottom: calc(24px + var(--safe-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 500;
  animation: workspaceToastIn 0.2s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
@keyframes workspaceToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Landscape mode: phones held sideways ── */
@media (orientation: landscape) and (max-height: 500px) {
  body.has-topbar { --topbar-h: 38px; }

  .sv-sidebar { display: none; }
  .workspace-header { padding: 6px 16px; }
  .sv-messages { flex: 1; }
  .mini-card-talk-btn { min-height: 44px; }
}

/* ═══════════════════════════════════════════════════════════════
   Discover Section — collapsible feature showcase above footer
   ═══════════════════════════════════════════════════════════════ */
.hub-discover {
  max-width: 800px;
  margin: 0 auto;
  padding: 8px 24px 24px;
}

.hub-discover-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  color: var(--color-text-muted, rgba(255,255,255,0.35));
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans, 'DM Sans', system-ui, sans-serif);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  text-align: left;
}
.hub-discover-toggle:hover {
  color: var(--color-text-secondary, rgba(255,255,255,0.55));
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
}

.hub-discover-toggle-icon {
  font-size: 11px;
  opacity: 0.6;
}

.hub-discover-toggle-arrow {
  margin-left: auto;
  font-size: 14px;
  transition: transform 0.25s ease;
}
.hub-discover-toggle--open .hub-discover-toggle-arrow {
  transform: rotate(90deg);
}

.hub-discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
  animation: hubDiscoverFadeIn 0.3s ease;
}
.hub-discover-grid[hidden] {
  display: none;
}

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

.hub-discover-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.hub-discover-card:hover {
  border-color: rgba(255,255,255,0.1);
}

.hub-discover-card-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.hub-discover-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, rgba(255,255,255,0.6));
  margin-bottom: 2px;
}

.hub-discover-card-desc {
  font-size: 11px;
  color: var(--color-text-muted, rgba(255,255,255,0.35));
  line-height: 1.4;
}

.hub-discover-see-all {
  grid-column: 1 / -1;
  text-align: center;
  padding: 10px 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(167,139,250,0.6);
  text-decoration: none;
  transition: color 0.2s;
}
.hub-discover-see-all:hover {
  color: rgba(167,139,250,0.9);
}

@media (max-width: 640px) {
  .hub-discover-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Quick-Start Banner — dismissible strip for new users
   ═══════════════════════════════════════════════════════════════ */
.hub-quickstart {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
  background: rgba(123,104,238,0.06);
  border: 1px solid rgba(123,104,238,0.12);
  border-radius: 12px;
  animation: hubQuickstartIn 0.3s ease;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .hub-quickstart {
    /* Stack: label on top, tips middle, dismiss aligned with label */
    align-items: stretch;
    padding: 12px 14px;
  }
  .hub-quickstart-label {
    flex: 1;
  }
  .hub-quickstart-tips {
    width: 100%;
    order: 2;
  }
  .hub-quickstart-dismiss {
    order: 1;
  }
}

@keyframes hubQuickstartIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hub-quickstart-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(167,139,250,0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.hub-quickstart-tips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.hub-quickstart-tip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  color: var(--color-text-secondary, rgba(255,255,255,0.55));
  font-size: 12px;
  font-family: var(--font-sans, 'DM Sans', system-ui, sans-serif);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.hub-quickstart-tip:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-primary, rgba(255,255,255,0.9));
}

.hub-quickstart-tip-icon {
  font-size: 13px;
}

.hub-quickstart-dismiss {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--color-text-muted, rgba(255,255,255,0.3));
  font-size: 16px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: var(--font-sans, 'DM Sans', system-ui, sans-serif);
}
.hub-quickstart-dismiss:hover {
  color: var(--color-text-secondary, rgba(255,255,255,0.6));
  background: rgba(255,255,255,0.06);
}

@media (max-width: 640px) {
  .hub-quickstart {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .hub-quickstart-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
  }
  .hub-quickstart {
    position: relative;
  }
}
